117172024-11-07 16:33:59balintZenehallgatáscpp17Wrong answer 0/50300ms828 KiB
#include <iostream>
#include <vector>
#include <numeric>
using namespace std;

int main() {
    int N, K;
    cin >> N >> K;
    
    vector<int> lengths(N);
    for (int i = 0; i < N; ++i) {
        cin >> lengths[i];
    }
    
    int sumed = accumulate(lengths.begin(), lengths.end(), 0);
    
    vector<int> returning;
    for (int i = 0; i < K; ++i) {
        int num;
        cin >> num;
        num %= sumed;
        
        for (int len_idx = 0; len_idx < N; ++len_idx) {
            num -= lengths[len_idx];
            if (num <= 0) {
                returning.push_back(len_idx);
                break;
            }
        }
    }
    

    for (size_t i = 0; i < returning.size(); ++i) {
        cout << returning[i];
        if (i < returning.size() - 1) {
            cout << " ";
        }
    }
    cout << endl;

    return 0;
}
SubtaskSumTestVerdictTimeMemory
base0/50
1Wrong answer0/01ms320 KiB
2Time limit exceeded0/0286ms824 KiB
3Wrong answer0/22ms320 KiB
4Wrong answer0/23ms320 KiB
5Wrong answer0/22ms408 KiB
6Wrong answer0/32ms320 KiB
7Wrong answer0/32ms320 KiB
8Wrong answer0/32ms320 KiB
9Time limit exceeded0/2300ms808 KiB
10Time limit exceeded0/2300ms808 KiB
11Time limit exceeded0/2300ms816 KiB
12Time limit exceeded0/2279ms804 KiB
13Time limit exceeded0/2300ms820 KiB
14Time limit exceeded0/2300ms804 KiB
15Time limit exceeded0/2300ms804 KiB
16Time limit exceeded0/2286ms824 KiB
17Time limit exceeded0/2289ms692 KiB
18Time limit exceeded0/2289ms800 KiB
19Time limit exceeded0/2300ms808 KiB
20Time limit exceeded0/2289ms808 KiB
21Time limit exceeded0/2280ms828 KiB
22Time limit exceeded0/3280ms804 KiB
23Time limit exceeded0/3298ms804 KiB
24Time limit exceeded0/3275ms824 KiB