245242026-02-12 17:18:24AkosVagyokEmborZenehallgatáscpp17Runtime error 9/50300ms32000 KiB
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
vector <int> zenek, st, seg;
int zsz, sszam, sum;
void be() {
    cin >> zsz>>sszam;
    zenek.resize(zsz+1);
    st.resize(sszam + 1);
    for (int i = 1; i <= zsz; i++) {
        cin >> zenek[i];
        sum += zenek[i];
        if (i != 1) {
            zenek[i] += zenek[i - 1];
        }
    }
    for (int i = 1; i <= sszam; i++) {
        cin >> st[i];        
    }
    int index = 0;
    seg.resize(sum + 1);
    for (int i = 1; i <= zsz; i++) {
        for (int j = 1; j <= zenek[i]; j++) {
            if (!seg[j]) {
                seg[j] = i;
            }
        }
    }
}
void nagy() {
    for (int k = 1; k <= sszam; k++) {
        int a;
        a = st[k] % sum;
        for (int i = 1; i <= sum; i++) {
            if (a==i) {
                cout << seg[i]<<' ';
                break;
            }

        }
    }
}



int main()
{
    be();
    nagy();

    
}

SubtaskSumTestVerdictTimeMemory
base9/50
1Accepted0/01ms316 KiB
2Runtime error0/0108ms32000 KiB
3Time limit exceeded0/2284ms19764 KiB
4Time limit exceeded0/2284ms10036 KiB
5Time limit exceeded0/2300ms2356 KiB
6Accepted3/356ms756 KiB
7Accepted3/329ms316 KiB
8Accepted3/38ms316 KiB
9Runtime error0/2101ms32000 KiB
10Runtime error0/2101ms32000 KiB
11Runtime error0/2105ms32000 KiB
12Runtime error0/2105ms32000 KiB
13Runtime error0/2103ms32000 KiB
14Runtime error0/2104ms32000 KiB
15Runtime error0/2104ms32000 KiB
16Runtime error0/297ms32000 KiB
17Runtime error0/2103ms32000 KiB
18Time limit exceeded0/2291ms20788 KiB
19Time limit exceeded0/2291ms20788 KiB
20Time limit exceeded0/2291ms3308 KiB
21Time limit exceeded0/2272ms3140 KiB
22Time limit exceeded0/3277ms3240 KiB
23Time limit exceeded0/3275ms1980 KiB
24Time limit exceeded0/3277ms1844 KiB