3090 2023. 02. 15 12:48:01 tamasmark Zenehallgatás cpp17 Elfogadva 50/50 50ms 5108 KiB
// zenehalgatas.cpp : This file contains the 'main' function. Program execution begins and ends there.
//

#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

long long n, i, k, a,ido;
vector<int>x;

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cin >> n>>k;
    for (i = 1; i <= n; ++i)
    {
        cin >> a;
        ido += a;
        x.push_back(ido);
    }
    for (i = 1; i <= k; ++i)
    {
        cin >> a;
        a = a % x[n - 1];
        cout << lower_bound(x.begin(), x.end(), a) - x.begin()+1<<" ";
    }
    return 0;
}
/*
3 2
2 4 3
6 10

*/
// 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 Összpont Teszt Verdikt Idő Memória
base 50/50
1 Elfogadva 0/0 3ms 1764 KiB
2 Elfogadva 0/0 50ms 3264 KiB
3 Elfogadva 2/2 3ms 2348 KiB
4 Elfogadva 2/2 3ms 2688 KiB
5 Elfogadva 2/2 3ms 2644 KiB
6 Elfogadva 3/3 3ms 2732 KiB
7 Elfogadva 3/3 3ms 2852 KiB
8 Elfogadva 3/3 3ms 3064 KiB
9 Elfogadva 2/2 48ms 4556 KiB
10 Elfogadva 2/2 48ms 4432 KiB
11 Elfogadva 2/2 50ms 4680 KiB
12 Elfogadva 2/2 50ms 4636 KiB
13 Elfogadva 2/2 50ms 4636 KiB
14 Elfogadva 2/2 50ms 4924 KiB
15 Elfogadva 2/2 48ms 4920 KiB
16 Elfogadva 2/2 48ms 4868 KiB
17 Elfogadva 2/2 48ms 4784 KiB
18 Elfogadva 2/2 48ms 4780 KiB
19 Elfogadva 2/2 48ms 5044 KiB
20 Elfogadva 2/2 48ms 5108 KiB
21 Elfogadva 2/2 46ms 5040 KiB
22 Elfogadva 3/3 48ms 5040 KiB
23 Elfogadva 3/3 46ms 5072 KiB
24 Elfogadva 3/3 46ms 5076 KiB