69332023-12-20 13:35:52szabelrZenehallgatáscpp17Runtime error 4/50252ms64932 KiB
#include <iostream>

using namespace std;

int main()
{
    int n,k,a,x=0,b;
    cin>>n;
    cin>>k;
    int h[n+1] {0}, hossz=0;
    h[0]=1;
    for(int i=1; i<=n; i++){
        cin>>a;
        h[i]=a+h[i-1];
        hossz=hossz+a;
    }
    int tomb[hossz+1] {0};
    for(int i=1; i<=n; i++){
        for(int y=x+1; y<=h[i]; y++){
            tomb[y]=i;
            x++;
        }
    }
    for(int i=1; i<=k; i++){
        cin>>b;
        if(b>hossz)
            b=b%hossz;
        cout<<tomb[b]<<" ";
    }

    return 0;
}
SubtaskSumTestVerdictTimeMemory
base4/50
1Accepted0/03ms1872 KiB
2Runtime error0/052ms64932 KiB
3Wrong answer0/223ms41516 KiB
4Accepted2/216ms22276 KiB
5Accepted2/26ms6632 KiB
6Wrong answer0/34ms3244 KiB
7Wrong answer0/34ms3236 KiB
8Wrong answer0/34ms3212 KiB
9Runtime error0/259ms63596 KiB
10Runtime error0/250ms63360 KiB
11Runtime error0/250ms63120 KiB
12Runtime error0/252ms63116 KiB
13Runtime error0/250ms62952 KiB
14Runtime error0/254ms62948 KiB
15Runtime error0/250ms62936 KiB
16Runtime error0/254ms62912 KiB
17Runtime error0/248ms62888 KiB
18Time limit exceeded0/2202ms44592 KiB
19Time limit exceeded0/2241ms44548 KiB
20Time limit exceeded0/2252ms9388 KiB
21Time limit exceeded0/2232ms9348 KiB
22Wrong answer0/3182ms9336 KiB
23Wrong answer0/3177ms7144 KiB
24Wrong answer0/3178ms6800 KiB