862021-01-10 18:05:04Babják PéterZenehallgatáscpp11Time limit exceeded 15/50293ms2116 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/02ms1816 KiB
2Time limit exceeded0/0282ms1916 KiB
3Accepted2/22ms1920 KiB
4Accepted2/22ms1928 KiB
5Accepted2/22ms1924 KiB
6Accepted3/31ms1924 KiB
7Accepted3/32ms1928 KiB
8Accepted3/32ms1924 KiB
9Time limit exceeded0/2286ms2040 KiB
10Time limit exceeded0/2284ms1920 KiB
11Time limit exceeded0/2293ms1920 KiB
12Time limit exceeded0/2291ms1984 KiB
13Time limit exceeded0/2293ms2056 KiB
14Time limit exceeded0/2291ms1980 KiB
15Time limit exceeded0/2284ms1920 KiB
16Time limit exceeded0/2293ms1980 KiB
17Time limit exceeded0/2291ms1984 KiB
18Time limit exceeded0/2291ms2044 KiB
19Time limit exceeded0/2280ms2044 KiB
20Time limit exceeded0/2293ms1980 KiB
21Time limit exceeded0/2291ms1992 KiB
22Time limit exceeded0/3293ms1984 KiB
23Time limit exceeded0/3293ms1920 KiB
24Time limit exceeded0/3280ms2116 KiB