29102023-02-02 14:39:14UnluckYZenehallgatáscpp11Wrong answer 0/50111ms10060 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;
    int 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/03ms1812 KiB
2Wrong answer0/0109ms7436 KiB
3Wrong answer0/24ms2360 KiB
4Wrong answer0/24ms2452 KiB
5Wrong answer0/24ms2664 KiB
6Wrong answer0/34ms3132 KiB
7Wrong answer0/33ms3148 KiB
8Wrong answer0/33ms3364 KiB
9Wrong answer0/2111ms8824 KiB
10Wrong answer0/2109ms8780 KiB
11Wrong answer0/2108ms9096 KiB
12Wrong answer0/2108ms9052 KiB
13Wrong answer0/2105ms9312 KiB
14Wrong answer0/2105ms9264 KiB
15Wrong answer0/2105ms9308 KiB
16Wrong answer0/2104ms9300 KiB
17Wrong answer0/2104ms9664 KiB
18Wrong answer0/2103ms9424 KiB
19Wrong answer0/2103ms9592 KiB
20Wrong answer0/2101ms9776 KiB
21Wrong answer0/2101ms9992 KiB
22Wrong answer0/3100ms10060 KiB
23Wrong answer0/3100ms9920 KiB
24Wrong answer0/3101ms9912 KiB