38242023-03-03 10:20:41ZsofiaKeresztelyZenehallgatáscpp14Time limit exceeded 15/50273ms13528 KiB
#include <bits/stdc++.h>
using namespace std;
#define pii pair<int, int>
#define fi first
#define se second

vector<vector<int> > d;

int main()
{
    int n, k, l=0;
    cin >> n >> k;
    set<pii> s;
    for (int i=1; i<=n; i++){
        int t;
        cin >> t;
        l += t;
        s.insert({l, i});
    }
    while (k--){
        int t;
        cin >> t;
        t %= l;
        if (!t) t = l;
        cout << (*s.lower_bound({t, 0})).se << " ";
    }
}
SubtaskSumTestVerdictTimeMemory
base15/50
1Accepted0/03ms1808 KiB
2Time limit exceeded0/0239ms11580 KiB
3Accepted2/24ms2512 KiB
4Accepted2/24ms2612 KiB
5Accepted2/24ms2864 KiB
6Accepted3/34ms2712 KiB
7Accepted3/34ms2712 KiB
8Accepted3/34ms2704 KiB
9Time limit exceeded0/2238ms12212 KiB
10Time limit exceeded0/2237ms12176 KiB
11Time limit exceeded0/2237ms12296 KiB
12Time limit exceeded0/2259ms6864 KiB
13Time limit exceeded0/2256ms7148 KiB
14Time limit exceeded0/2238ms12680 KiB
15Time limit exceeded0/2232ms12868 KiB
16Time limit exceeded0/2268ms7668 KiB
17Time limit exceeded0/2248ms13040 KiB
18Time limit exceeded0/2231ms12972 KiB
19Time limit exceeded0/2228ms7544 KiB
20Time limit exceeded0/2268ms7836 KiB
21Time limit exceeded0/2231ms13528 KiB
22Time limit exceeded0/3230ms13472 KiB
23Time limit exceeded0/3273ms7992 KiB
24Time limit exceeded0/3259ms7984 KiB