125672024-12-23 13:23:18nkbalintZenehallgatáscpp17Wrong answer 15/50254ms1764 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/01ms500 KiB
2Time limit exceeded0/0241ms1584 KiB
3Accepted2/23ms320 KiB
4Accepted2/23ms320 KiB
5Accepted2/23ms320 KiB
6Accepted3/33ms320 KiB
7Accepted3/33ms508 KiB
8Accepted3/33ms320 KiB
9Time limit exceeded0/2254ms1640 KiB
10Time limit exceeded0/2254ms1764 KiB
11Time limit exceeded0/2246ms1596 KiB
12Time limit exceeded0/2238ms1592 KiB
13Time limit exceeded0/2245ms1592 KiB
14Time limit exceeded0/2248ms1700 KiB
15Time limit exceeded0/2248ms1592 KiB
16Time limit exceeded0/2231ms1592 KiB
17Time limit exceeded0/2250ms1592 KiB
18Time limit exceeded0/2248ms1752 KiB
19Time limit exceeded0/2244ms1592 KiB
20Time limit exceeded0/2224ms1592 KiB
21Time limit exceeded0/2245ms1548 KiB
22Time limit exceeded0/3238ms1592 KiB
23Time limit exceeded0/3241ms1588 KiB
24Time limit exceeded0/3216ms1592 KiB