244382026-02-11 16:10:50tamasnagyZenehallgatáscpp17Elfogadva 50/5048ms1396 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()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    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
RészfeladatÖsszpontTesztVerdiktIdőMemória
base50/50
1Elfogadva0/01ms316 KiB
2Elfogadva0/048ms1332 KiB
3Elfogadva2/21ms316 KiB
4Elfogadva2/21ms316 KiB
5Elfogadva2/21ms316 KiB
6Elfogadva3/31ms388 KiB
7Elfogadva3/31ms316 KiB
8Elfogadva3/31ms424 KiB
9Elfogadva2/248ms1240 KiB
10Elfogadva2/248ms1284 KiB
11Elfogadva2/248ms1340 KiB
12Elfogadva2/248ms1372 KiB
13Elfogadva2/246ms1376 KiB
14Elfogadva2/246ms1332 KiB
15Elfogadva2/246ms1244 KiB
16Elfogadva2/248ms1396 KiB
17Elfogadva2/248ms1280 KiB
18Elfogadva2/246ms1328 KiB
19Elfogadva2/246ms1356 KiB
20Elfogadva2/246ms1336 KiB
21Elfogadva2/246ms1332 KiB
22Elfogadva3/346ms1396 KiB
23Elfogadva3/345ms1212 KiB
24Elfogadva3/345ms1332 KiB