244412026-02-11 16:13:21tamasnagyZenehallgatáscpp17Wrong answer 0/5061ms1196 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 << ' ';*/
        int x = 1;
        while (hossz[x] < p) {
            p -= hossz[x];
            x++;
        }
        cout << x << ' ';
    }
}

// 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
base0/50
1Accepted0/01ms316 KiB
2Wrong answer0/061ms1124 KiB
3Wrong answer0/21ms316 KiB
4Wrong answer0/21ms316 KiB
5Wrong answer0/21ms316 KiB
6Wrong answer0/31ms420 KiB
7Wrong answer0/31ms316 KiB
8Wrong answer0/31ms508 KiB
9Wrong answer0/259ms1076 KiB
10Wrong answer0/259ms1080 KiB
11Wrong answer0/261ms1088 KiB
12Wrong answer0/261ms1196 KiB
13Wrong answer0/259ms1028 KiB
14Wrong answer0/259ms1112 KiB
15Wrong answer0/259ms1092 KiB
16Wrong answer0/259ms1188 KiB
17Wrong answer0/259ms1076 KiB
18Wrong answer0/259ms1084 KiB
19Wrong answer0/259ms1188 KiB
20Wrong answer0/257ms1076 KiB
21Wrong answer0/257ms1080 KiB
22Wrong answer0/357ms1076 KiB
23Wrong answer0/357ms1136 KiB
24Wrong answer0/357ms1076 KiB