81432024-01-12 14:32:28norbertvidaZenehallgatáscpp17Time limit exceeded 48/50202ms22316 KiB
#include <bits/stdc++.h>

using namespace std;

int N, K, Ts, i, t;
map<int, int> L, C;

int main() {
    iostream::sync_with_stdio(0);
    cin.tie(0);
    cin >> N >> K;
    for(i = 0; i < N; i++) {
        cin >> t;
        Ts += t;
        L[Ts] = i;
    }
    for(i = 0; i < K; i++) {
        cin >> t;
        t %= Ts;
        if(!C.count(t)) C[t] = L.lower_bound(t)->second + 1;
        cout << C[t] << " ";
    }
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base48/50
1Accepted0/03ms1932 KiB
2Accepted0/0180ms20956 KiB
3Accepted2/24ms2392 KiB
4Accepted2/24ms2620 KiB
5Accepted2/24ms2832 KiB
6Accepted3/33ms2792 KiB
7Accepted3/33ms2788 KiB
8Accepted3/33ms3052 KiB
9Accepted2/2180ms21596 KiB
10Accepted2/2193ms21724 KiB
11Accepted2/2190ms21972 KiB
12Accepted2/2189ms22196 KiB
13Accepted2/2175ms22128 KiB
14Accepted2/2175ms22020 KiB
15Accepted2/2177ms22044 KiB
16Accepted2/2174ms22272 KiB
17Accepted2/2178ms22292 KiB
18Accepted2/2185ms22172 KiB
19Time limit exceeded0/2202ms22316 KiB
20Accepted2/2177ms21684 KiB
21Accepted2/2172ms21452 KiB
22Accepted3/3170ms21704 KiB
23Accepted3/3165ms20924 KiB
24Accepted3/3160ms20524 KiB