145932025-01-19 17:33:59TundeZenehallgatáscpp17Time limit exceeded 15/50300ms948 KiB
#include <iostream>

using namespace std;

struct idopont
{
    int s, e;
};

int main()
{
    int n, k, x;
    cin >> n >> k;
    int t[n];
    int hossz=0;
    for(int i=0; i<n; i++)
    {
        cin >> t[i];
        hossz+=t[i];
        t[i]=hossz;
    }
    int p[k];
    int u=0, j=0;
    for(int i=0; i<k; i++)
    {
        cin >> x;
        if(x%hossz!=0)
            x=x%hossz;
        else
        {
            x=x;
        }
        int j=0;
        while(t[j]<x)
        {
            ++j;
        }
        p[i]=j+1;
    }
    for(int i=0; i<k; i++)
    {
        cout << p[i] << " ";
    }
}
SubtaskSumTestVerdictTimeMemory
base15/50
1Accepted0/01ms500 KiB
2Time limit exceeded0/0280ms820 KiB
3Accepted2/22ms316 KiB
4Accepted2/22ms316 KiB
5Accepted2/22ms356 KiB
6Accepted3/32ms316 KiB
7Accepted3/32ms316 KiB
8Accepted3/32ms316 KiB
9Time limit exceeded0/2300ms820 KiB
10Time limit exceeded0/2300ms784 KiB
11Time limit exceeded0/2300ms820 KiB
12Time limit exceeded0/2282ms820 KiB
13Time limit exceeded0/2284ms948 KiB
14Time limit exceeded0/2286ms820 KiB
15Time limit exceeded0/2300ms732 KiB
16Time limit exceeded0/2284ms820 KiB
17Time limit exceeded0/2284ms820 KiB
18Time limit exceeded0/2284ms820 KiB
19Time limit exceeded0/2300ms820 KiB
20Time limit exceeded0/2282ms792 KiB
21Time limit exceeded0/2277ms816 KiB
22Time limit exceeded0/3279ms784 KiB
23Time limit exceeded0/3300ms784 KiB
24Time limit exceeded0/3279ms820 KiB