58612023-10-04 16:27:40KCsengeZenehallgatáscpp14Wrong answer 0/50282ms5012 KiB
#include <iostream>

using namespace std;
/*
3 2
2 4 3
6 10

5 3
3 2 7 8 1
10 50 20

8 6
10 2 7 15 20 30 2 4
100 40 200 170 80 60
*/

int main()
{
    int x=0, i,j,n,k;
    cin>>n>>k;
    int t[n], p[k],resz[n];
    for(i=0;i<n;i++)
    {
        cin>>t[i];
        x=t[i]+x;
        resz[i]=x;
    }
    for(i=0;i<k;i++)
    {
        cin>>p[i];
    }

    cout << "Hello world!" << endl;
    for(j=0;j<k;j++)
    { i=0;
      int szamol=1;
        if(p[j]%x==0)
        {
            cout<<n;
        }

        else if(p[j]<x)
        {
            while(p[j]>resz[i])
            {
                i++;
                szamol++;
            }
            cout<<szamol<<" ";
        }
        else
        {
            while(p[j]>x)
            {
                p[j]=p[j]-x;
            }
            while(p[j]>resz[i])
            {
                i++;
                szamol++;
            }
            cout<<szamol<<" ";
        }
    }
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base0/50
1Wrong answer0/03ms1744 KiB
2Time limit exceeded0/0266ms2280 KiB
3Wrong answer0/24ms2136 KiB
4Wrong answer0/24ms2216 KiB
5Wrong answer0/24ms2340 KiB
6Wrong answer0/38ms2856 KiB
7Wrong answer0/313ms3016 KiB
8Wrong answer0/346ms3140 KiB
9Time limit exceeded0/2282ms3852 KiB
10Time limit exceeded0/2248ms3868 KiB
11Time limit exceeded0/2246ms3912 KiB
12Time limit exceeded0/2273ms3824 KiB
13Time limit exceeded0/2257ms3928 KiB
14Time limit exceeded0/2250ms3948 KiB
15Time limit exceeded0/2266ms4316 KiB
16Time limit exceeded0/2273ms4524 KiB
17Time limit exceeded0/2261ms4284 KiB
18Time limit exceeded0/2266ms4472 KiB
19Time limit exceeded0/2256ms4496 KiB
20Time limit exceeded0/2261ms4592 KiB
21Time limit exceeded0/2261ms4700 KiB
22Time limit exceeded0/3277ms4800 KiB
23Time limit exceeded0/3256ms4872 KiB
24Time limit exceeded0/3257ms5012 KiB