162662025-04-17 21:07:06DhaneHaneZenehallgatáscpp17Time limit exceeded 15/50300ms1268 KiB
// zene.cpp : This file contains the 'main' function. Program execution begins and ends there.
//

#include <iostream>
#include <vector>
using namespace std;

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int n, k, osz = 0; cin >> n >> k;
    vector <int> zene(n + 1), time(k+1);
    for (int i = 1; i <= n; ++i) {
        cin >> zene[i];
        osz += zene[i];
    }
    int akt, j;
    for (int i = 1; i <= k; ++i) {
        cin >> time[i];
    }
    for (int i=1;i<=k;++i){
        akt= time[i] % osz;
        if (akt == 0) {
            cout << n<< " ";
        }
        else {
            j = 0;
            while (akt > 0) {
                ++j;
                akt -= zene[j];
            }
            cout << j << " ";
        }
    }
}

// Run program: Ctrl + F5 or Debug > Start Without Debugging menu
// Debug program: F5 or Debug > Start Debugging menu

// Tips for Getting Started: 
//   1. Use the Solution Explorer window to add/manage files
//   2. Use the Team Explorer window to connect to source control
//   3. Use the Output window to see build output and other messages
//   4. Use the Error List window to view errors
//   5. Go to Project > Add New Item to create new code files, or Project > Add Existing Item to add existing code files to the project
//   6. In the future, to open this project again, go to File > Open > Project and select the .sln file
SubtaskSumTestVerdictTimeMemory
base15/50
1Accepted0/01ms316 KiB
2Time limit exceeded0/0286ms1228 KiB
3Accepted2/22ms316 KiB
4Accepted2/22ms316 KiB
5Accepted2/21ms316 KiB
6Accepted3/31ms316 KiB
7Accepted3/32ms316 KiB
8Accepted3/31ms316 KiB
9Time limit exceeded0/2300ms1076 KiB
10Time limit exceeded0/2300ms1224 KiB
11Time limit exceeded0/2300ms1076 KiB
12Time limit exceeded0/2277ms1076 KiB
13Time limit exceeded0/2284ms1224 KiB
14Time limit exceeded0/2284ms1228 KiB
15Time limit exceeded0/2300ms1220 KiB
16Time limit exceeded0/2286ms1076 KiB
17Time limit exceeded0/2284ms1076 KiB
18Time limit exceeded0/2284ms1076 KiB
19Time limit exceeded0/2300ms1212 KiB
20Time limit exceeded0/2286ms1076 KiB
21Time limit exceeded0/2273ms1268 KiB
22Time limit exceeded0/3273ms1252 KiB
23Time limit exceeded0/3300ms1224 KiB
24Time limit exceeded0/3287ms1076 KiB