67852023-12-19 09:56:15madvirZenehallgatáscpp17Runtime error 21/50246ms64928 KiB
#include <iostream>

using namespace std;

int main()
{
    int n, k;
    cin >> n >> k;
    int h[n+1], hossz=0;
    for(int i=1; i<=n; i++) {
        cin >> h[i];
        hossz+=h[i];
    }

    int p[hossz+1], x=1, y;
    for(int i=1; i<=n; i++) {
        y=x;
        while(y<x+h[i]) {
            p[y]=i;
            y++;
        }
        x=y;
    }
    p[0]=p[hossz];
    int z;
    for(int i=0; i<k; i++) {
        cin >> z;
        if(z>hossz) cout << p[z%hossz] << " ";
        else cout << p[z] << " ";
    }

    return 0;
}
SubtaskSumTestVerdictTimeMemory
base21/50
1Accepted0/03ms1872 KiB
2Runtime error0/054ms64928 KiB
3Accepted2/223ms41368 KiB
4Accepted2/214ms22076 KiB
5Accepted2/26ms6676 KiB
6Accepted3/34ms3184 KiB
7Accepted3/34ms3420 KiB
8Accepted3/34ms3444 KiB
9Runtime error0/254ms63656 KiB
10Runtime error0/252ms63584 KiB
11Runtime error0/250ms63452 KiB
12Runtime error0/257ms63240 KiB
13Runtime error0/254ms63176 KiB
14Runtime error0/254ms63168 KiB
15Runtime error0/248ms63100 KiB
16Runtime error0/254ms62872 KiB
17Runtime error0/248ms62704 KiB
18Accepted2/2197ms44744 KiB
19Accepted2/2199ms44628 KiB
20Accepted2/2184ms9552 KiB
21Time limit exceeded0/2246ms6512 KiB
22Time limit exceeded0/3206ms9876 KiB
23Time limit exceeded0/3206ms7480 KiB
24Time limit exceeded0/3223ms7184 KiB