125662024-12-23 13:21:33nkbalintZenehallgatáscpp17Wrong answer 15/50252ms1748 KiB
#include <iostream>

using namespace std;

int N, K, v[100001], x[100001], a, i, b, j, kozep, c, p;

int main()
{
    cin >> N >> K;
    for (i = 1;i <= N;++i)
    {
        cin >> a;
        v[i] = v[i - 1] + a;
    }
    for (i = 1;i <= K;++i)
    {
        cin >> x[i];
    }
    for (i = 1;i <= K;++i)
    {
        b = 1;
        j = N;
        c = x[i];
        c = c % v[K];
        while (b <= j)
        {
            kozep = (b + j) / 2;
            if (v[kozep] == c)
            {
                b = kozep;
                break;
            }
            else if (v[kozep] > c) j = kozep - 1;
            else b = kozep + 1;
        }
        if (v[b] >= c) cout << b << endl;
        else cout << b - 1 << endl;

    }
}
SubtaskSumTestVerdictTimeMemory
base15/50
1Wrong answer0/01ms320 KiB
2Time limit exceeded0/0246ms1576 KiB
3Accepted2/23ms320 KiB
4Accepted2/23ms512 KiB
5Accepted2/23ms320 KiB
6Accepted3/33ms324 KiB
7Accepted3/33ms320 KiB
8Accepted3/33ms500 KiB
9Time limit exceeded0/2245ms1684 KiB
10Time limit exceeded0/2244ms1668 KiB
11Time limit exceeded0/2252ms1592 KiB
12Time limit exceeded0/2248ms1592 KiB
13Time limit exceeded0/2240ms1640 KiB
14Time limit exceeded0/2240ms1592 KiB
15Time limit exceeded0/2241ms1592 KiB
16Time limit exceeded0/2239ms1628 KiB
17Time limit exceeded0/2246ms1620 KiB
18Time limit exceeded0/2238ms1632 KiB
19Time limit exceeded0/2236ms1592 KiB
20Time limit exceeded0/2233ms1592 KiB
21Time limit exceeded0/2236ms1748 KiB
22Time limit exceeded0/3243ms1592 KiB
23Time limit exceeded0/3232ms1592 KiB
24Time limit exceeded0/3210ms1724 KiB