29152023-02-03 08:54:09tamasmarkZenehallgatáscpp17Futási hiba 23/50203ms65060 KiB
// zenehalgatas.cpp : This file contains the 'main' function. Program execution begins and ends there.
//

#include <iostream>
#include <vector>

using namespace std;

struct adat
{
    long long kezd, veg;
};

long long n, k, i,a,b,j,h;
vector <int> x;
vector<long long>megold;

int main()
{
    cin >> n >> k;
    h = 1;
    for (i = 1; i <= n; ++i)
    {
        cin >> a;
        for (j = 1; j <= a; ++j)
        {
            x.push_back(i);
        }
    }
    /*for (i = 0; i < x.size(); ++i)
    {
        cout << x[i].kezd << " " << x[i].veg << "\n";
    }*/
    for (i = 1; i <= k; ++i)
    {
        cin >> a;
        a = a - 1;
        if (a > x.size()-1)
        {
            while (a > x.size()-1)
            {
                a = a - x.size();
            }
            megold.push_back(x[a]);
        }
        else 
        {
            megold.push_back(x[a]);
        }
    }
    for (i = 0; i < megold.size(); ++i)
    {
        cout << megold[i] << " ";
    }
    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ÖsszpontTesztVerdiktIdőMemória
base23/50
1Elfogadva0/03ms1748 KiB
2Futási hiba0/064ms65060 KiB
3Futási hiba0/252ms64824 KiB
4Elfogadva2/228ms35308 KiB
5Elfogadva2/28ms6820 KiB
6Elfogadva3/38ms3360 KiB
7Elfogadva3/313ms3324 KiB
8Elfogadva3/346ms3300 KiB
9Futási hiba0/264ms63740 KiB
10Futási hiba0/263ms63536 KiB
11Futási hiba0/261ms63532 KiB
12Futási hiba0/263ms63292 KiB
13Futási hiba0/250ms63056 KiB
14Futási hiba0/265ms63032 KiB
15Futási hiba0/265ms63008 KiB
16Futási hiba0/268ms62784 KiB
17Futási hiba0/261ms62780 KiB
18Futási hiba0/268ms62552 KiB
19Futási hiba0/268ms62544 KiB
20Elfogadva2/2131ms12752 KiB
21Elfogadva2/2136ms12732 KiB
22Elfogadva3/3135ms12724 KiB
23Elfogadva3/3181ms9348 KiB
24Időlimit túllépés0/3203ms8948 KiB