124172024-12-17 13:52:03markfsibianZenehallgatáscpp17Time limit exceeded 15/50256ms1380 KiB
#include <iostream>

using namespace std;

int v[100001], n, m;

int bins(int v[100001], int n, int t)
{
    t = t % v[n];
    int b = 1;
    int j = n;
    int k;
    int m = (b + j) / 2;
    while (b <= j)
    {
        k = (b + j) / 2;
        if (v[k] == t)
            return k;
        else if (v[k] > t)
            j = k - 1;
        else
            b = k + 1;
    }
    return b;
}

int main()
{
    cin >> n >> m;
    int a;
    for (int i = 1; i <= n; ++i)
    {
        cin >> a;
        v[i] = v[i - 1] + a;
    }
    for (int i = 1; i <= m; ++i)
    {
        cin >> a;
        cout << bins(v, n, a) << " ";
    }
}
SubtaskSumTestVerdictTimeMemory
base15/50
1Accepted0/01ms320 KiB
2Time limit exceeded0/0246ms1360 KiB
3Accepted2/23ms320 KiB
4Accepted2/23ms508 KiB
5Accepted2/23ms320 KiB
6Accepted3/33ms320 KiB
7Accepted3/33ms544 KiB
8Accepted3/33ms320 KiB
9Time limit exceeded0/2256ms1272 KiB
10Time limit exceeded0/2250ms1336 KiB
11Time limit exceeded0/2254ms1256 KiB
12Time limit exceeded0/2244ms1336 KiB
13Time limit exceeded0/2246ms1380 KiB
14Time limit exceeded0/2254ms1152 KiB
15Time limit exceeded0/2252ms1324 KiB
16Time limit exceeded0/2243ms1336 KiB
17Time limit exceeded0/2252ms1332 KiB
18Time limit exceeded0/2244ms1200 KiB
19Time limit exceeded0/2254ms1336 KiB
20Time limit exceeded0/2238ms1336 KiB
21Time limit exceeded0/2247ms1328 KiB
22Time limit exceeded0/3246ms1332 KiB
23Time limit exceeded0/3239ms1336 KiB
24Time limit exceeded0/3218ms1336 KiB