852021-01-10 17:58:11Babják PéterZenehallgatáscpp11Time limit exceeded 15/50293ms12744 KiB
#include <bits/stdc++.h>
#define ll long long
using namespace std;
int main()
{
    ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
    int  n,k;cin>>n>>k;
    short int t[n];
    ll sum=0;
    ll subsum[n];
    cin>>t[0];sum+=t[0];
    subsum[0]=t[0];
    for(int i=1;i<n;i++)
    {
        cin>>t[i];
        sum+=t[i];//túlcsordulás
        subsum[i]=subsum[i-1]+t[i];
    }
    for(int i=0;i<k;i++)
    {
        ll a;cin>>a;
        a=(a%sum);
        for(int i=0;i<n;i++)
        {
            if(subsum[i]>=a)
            {
                cout<<i+1<<" ";
                break;
            }
        }
    }
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base15/50
1Accepted0/01ms1820 KiB
2Time limit exceeded0/0280ms2816 KiB
3Accepted2/21ms2688 KiB
4Accepted2/21ms2708 KiB
5Accepted2/22ms2728 KiB
6Accepted3/31ms2776 KiB
7Accepted3/32ms2788 KiB
8Accepted3/32ms2776 KiB
9Time limit exceeded0/2284ms3600 KiB
10Time limit exceeded0/2286ms4292 KiB
11Time limit exceeded0/2284ms5024 KiB
12Time limit exceeded0/2293ms5920 KiB
13Time limit exceeded0/2291ms6492 KiB
14Time limit exceeded0/2273ms7052 KiB
15Time limit exceeded0/2277ms7744 KiB
16Time limit exceeded0/2289ms8364 KiB
17Time limit exceeded0/2277ms9000 KiB
18Time limit exceeded0/2291ms9556 KiB
19Time limit exceeded0/2286ms10248 KiB
20Time limit exceeded0/2204ms10684 KiB
21Time limit exceeded0/2210ms11240 KiB
22Time limit exceeded0/3216ms11872 KiB
23Time limit exceeded0/3225ms12236 KiB
24Time limit exceeded0/3215ms12744 KiB