69322023-12-20 13:30:34szabelrZenehallgatáscpp17Runtime error 4/50280ms64932 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==0)
            b=hossz;
        else
            b=b%hossz;
        cout<<tomb[b]<<" ";
    }

    return 0;
}
SubtaskSumTestVerdictTimeMemory
base4/50
1Accepted0/03ms1876 KiB
2Runtime error0/059ms64932 KiB
3Wrong answer0/224ms41372 KiB
4Accepted2/216ms22200 KiB
5Accepted2/28ms6944 KiB
6Wrong answer0/34ms3608 KiB
7Wrong answer0/34ms3348 KiB
8Wrong answer0/34ms3396 KiB
9Runtime error0/254ms63616 KiB
10Runtime error0/259ms63504 KiB
11Runtime error0/252ms63268 KiB
12Runtime error0/256ms63044 KiB
13Runtime error0/254ms63016 KiB
14Runtime error0/248ms63004 KiB
15Runtime error0/254ms62996 KiB
16Runtime error0/254ms62920 KiB
17Runtime error0/252ms62684 KiB
18Time limit exceeded0/2201ms44920 KiB
19Time limit exceeded0/2280ms24020 KiB
20Wrong answer0/2187ms10048 KiB
21Wrong answer0/2175ms9916 KiB
22Wrong answer0/3178ms9844 KiB
23Wrong answer0/3178ms7492 KiB
24Wrong answer0/3174ms7152 KiB