244342026-02-11 16:01:25tamasnagyZenehallgatáscpp17Időlimit túllépés 15/50300ms1068 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);
    for (int i = 0; i < n; i++) {
        cin >> hossz[i];
        sum += hossz[i];
    }
    for (int i = 0; i < k; i++) {
        int p;
        cin >> p;
        p %= sum;
        int x = 0;
        while (hossz[x] < p) {
            p -= hossz[x];
            x++;
        }
        cout << x+1 << ' ';
    }
}

// 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
base15/50
1Elfogadva0/02ms508 KiB
2Időlimit túllépés0/0275ms820 KiB
3Elfogadva2/24ms316 KiB
4Elfogadva2/24ms316 KiB
5Elfogadva2/23ms316 KiB
6Elfogadva3/33ms316 KiB
7Elfogadva3/34ms316 KiB
8Elfogadva3/33ms316 KiB
9Időlimit túllépés0/2300ms804 KiB
10Időlimit túllépés0/2300ms804 KiB
11Időlimit túllépés0/2300ms800 KiB
12Időlimit túllépés0/2282ms820 KiB
13Időlimit túllépés0/2280ms820 KiB
14Időlimit túllépés0/2280ms820 KiB
15Időlimit túllépés0/2300ms820 KiB
16Időlimit túllépés0/2282ms820 KiB
17Időlimit túllépés0/2273ms816 KiB
18Időlimit túllépés0/2275ms1068 KiB
19Időlimit túllépés0/2300ms820 KiB
20Időlimit túllépés0/2277ms820 KiB
21Időlimit túllépés0/2284ms820 KiB
22Időlimit túllépés0/3286ms804 KiB
23Időlimit túllépés0/3300ms820 KiB
24Időlimit túllépés0/3284ms812 KiB