29112023-02-02 18:09:19UnluckYZenehallgatáscpp11Wrong answer 0/50115ms9824 KiB
#include <bits/stdc++.h>

using namespace std;

int main(){


    int n, k; cin >> n >> k;
    vector<int> v;
    vector<pair<int, int>> t, mego;
    long long mod = 0;

    for (int i = 0; i < n; i++){
        int x; cin >> x; v.push_back(x);
        mod += x;
    }

    for (int i = 0; i < k; i++){
        int x; cin >> x; t.push_back({x%mod, i});
    }

    sort(t.begin(), t.end());

    int most = 1, j = 0;

    for (int i = 0; i < n; i++){
        if (j == k) break;
        most += v[i];
        while (true){
            if (t[j].first < most){
                mego.push_back({t[j].second, i+1});
                j++;
                if (j == k) break;
            else {
                break;
            }
            }
        }
    } 

    sort(mego.begin(), mego.end());

    for (auto i : mego){
        cout << i.second << " ";
    }

    // 11 2222 333 11 2222 333

    return 0;
}
SubtaskSumTestVerdictTimeMemory
base0/50
1Accepted0/03ms1808 KiB
2Wrong answer0/0115ms7396 KiB
3Wrong answer0/24ms2240 KiB
4Wrong answer0/24ms2464 KiB
5Wrong answer0/24ms2668 KiB
6Wrong answer0/33ms2872 KiB
7Wrong answer0/34ms3084 KiB
8Wrong answer0/33ms3172 KiB
9Wrong answer0/2114ms8404 KiB
10Wrong answer0/2114ms8672 KiB
11Wrong answer0/2115ms8632 KiB
12Wrong answer0/2112ms8764 KiB
13Wrong answer0/2111ms8916 KiB
14Wrong answer0/2111ms9008 KiB
15Wrong answer0/2109ms8948 KiB
16Wrong answer0/2112ms9212 KiB
17Wrong answer0/2108ms9160 KiB
18Wrong answer0/2108ms9480 KiB
19Wrong answer0/2108ms9440 KiB
20Wrong answer0/2104ms9444 KiB
21Wrong answer0/2104ms9436 KiB
22Wrong answer0/3104ms9568 KiB
23Wrong answer0/3105ms9824 KiB
24Wrong answer0/3104ms9824 KiB