244372026-02-11 16:09:32tamasnagyZenehallgatáscpp17Time limit exceeded 15/50259ms1388 KiB

// zene.cpp : This file contains the 'main' function. Program execution begins and ends there.
//

#include <iostream>
#include <vector>
using namespace std;
vector<int>hossz;
int main()
{
    int n, k,sum=0;
    cin >> n >> k;
    hossz.resize(n+1);
    for (int i = 1; i <= n; i++) {
        cin >> hossz[i];
        sum += hossz[i];
        hossz[i] += hossz[i - 1];
    }
    for (int i = 0; i < k; i++) {
        int p;
        cin >> p;
        p %= sum;
        int hely = lower_bound(hossz.begin(), hossz.end(), p) - hossz.begin();
        cout << hely << ' ';
    }
}

// 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/0254ms1332 KiB
3Accepted2/23ms316 KiB
4Accepted2/23ms316 KiB
5Accepted2/23ms500 KiB
6Accepted3/33ms316 KiB
7Accepted3/33ms316 KiB
8Accepted3/33ms508 KiB
9Time limit exceeded0/2252ms1332 KiB
10Time limit exceeded0/2259ms1368 KiB
11Time limit exceeded0/2252ms1320 KiB
12Time limit exceeded0/2246ms1380 KiB
13Time limit exceeded0/2252ms1312 KiB
14Time limit exceeded0/2246ms1312 KiB
15Time limit exceeded0/2250ms1372 KiB
16Time limit exceeded0/2245ms1336 KiB
17Time limit exceeded0/2252ms1364 KiB
18Time limit exceeded0/2248ms1328 KiB
19Time limit exceeded0/2241ms1332 KiB
20Time limit exceeded0/2240ms1324 KiB
21Time limit exceeded0/2240ms1312 KiB
22Time limit exceeded0/3246ms1388 KiB
23Time limit exceeded0/3246ms1328 KiB
24Time limit exceeded0/3216ms1348 KiB