149092025-02-07 10:20:43markfsibianZenehallgatáscpp17Time limit exceeded 0/50252ms1772 KiB
#include <iostream>
#include <algorithm>
#include <vector>

using namespace std;


int n, m;

int bins(vector<int> v, int t)
{
    t = t % v.back();
    int b = 1;
    int j = n;
    int k;
    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;
    vector<int> v;
    v.push_back(0);
    for (int i = 1; i <= n; ++i)
    {
        cin >> a;
        v.push_back(v.back() + a);
    }
    for (int i = 1; i <= m; ++i)
    {
        cin >> a;
        cout << binary_search(v.begin(), v.end(), a) + 1 << " ";
    }
}
SubtaskSumTestVerdictTimeMemory
base0/50
1Accepted0/01ms320 KiB
2Time limit exceeded0/0236ms1700 KiB
3Wrong answer0/23ms316 KiB
4Wrong answer0/23ms316 KiB
5Wrong answer0/23ms544 KiB
6Wrong answer0/33ms316 KiB
7Wrong answer0/33ms316 KiB
8Wrong answer0/33ms316 KiB
9Time limit exceeded0/2252ms1716 KiB
10Time limit exceeded0/2239ms1772 KiB
11Time limit exceeded0/2238ms1708 KiB
12Time limit exceeded0/2236ms1708 KiB
13Time limit exceeded0/2243ms1708 KiB
14Time limit exceeded0/2233ms1656 KiB
15Time limit exceeded0/2232ms1704 KiB
16Time limit exceeded0/2232ms1708 KiB
17Time limit exceeded0/2231ms1708 KiB
18Time limit exceeded0/2238ms1704 KiB
19Time limit exceeded0/2230ms1708 KiB
20Time limit exceeded0/2228ms1704 KiB
21Time limit exceeded0/2234ms1704 KiB
22Time limit exceeded0/3229ms1708 KiB
23Time limit exceeded0/3228ms1584 KiB
24Time limit exceeded0/3212ms1708 KiB