13662022-05-23 13:30:21nkdorka1212Zenehallgatáscpp11Accepted 50/5064ms25576 KiB
#include <bits/stdc++.h>
using namespace std;
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
#define accept_plss ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define int long long

signed main()
{
    accept_plss;
    int n,k;
    cin>>n>>k;
    vector<int>prefix(n+1,0);
    for(int i=1;i<=n;i++)
    {
        cin>>prefix[i];
        prefix[i]+=prefix[i-1];
    }
    while(k--)
    {
        int t;
        cin>>t;
        t%=prefix[n];
        cout<<lower_bound(prefix.begin(),prefix.end(),t)-prefix.begin()<<" ";
    }
    cout<<"\n";
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base50/50
1Accepted0/02ms1820 KiB
2Accepted0/048ms4724 KiB
3Accepted2/21ms3316 KiB
4Accepted2/21ms3332 KiB
5Accepted2/21ms3352 KiB
6Accepted3/31ms3364 KiB
7Accepted3/32ms3376 KiB
8Accepted3/31ms3396 KiB
9Accepted2/246ms6268 KiB
10Accepted2/250ms7692 KiB
11Accepted2/248ms9112 KiB
12Accepted2/264ms10524 KiB
13Accepted2/263ms11880 KiB
14Accepted2/248ms13212 KiB
15Accepted2/252ms14524 KiB
16Accepted2/250ms15828 KiB
17Accepted2/250ms17192 KiB
18Accepted2/248ms18440 KiB
19Accepted2/250ms19704 KiB
20Accepted2/252ms20868 KiB
21Accepted2/252ms22052 KiB
22Accepted3/350ms23188 KiB
23Accepted3/346ms24376 KiB
24Accepted3/352ms25576 KiB