245762026-02-12 20:38:59AkosVagyokEmborZenehallgatáspython3Runtime error 0/5017ms3072 KiB
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
vector <int> zenek, st;
int zsz, sszam;
void be() {
    cin >> zsz>>sszam;
    zenek.resize(zsz+1);
    st.resize(sszam + 1);
    for (int i = 1; i <= zsz; i++) {
        cin >> zenek[i];
        if (i != 1) {
            zenek[i] += zenek[i-1];
        }
    }
    int index = 0;
}
void nagy() {
    for (int i = 1; i <= sszam; i++) {
        int a;
        cin >> a;
        a = a % zenek[zenek.size() - 1];
        int mid = zsz / 2;
        if (a<=zenek[mid]) {
            for (int j = 1; j <= mid; j++) {
                if (a <= zenek[j]) {
                    cout << j;
                    break;
                }
            }
        }
        else {
            for (int j = zsz; j >= mid+1; j--) {
                if (a > zenek[j]) {
                    cout << j;
                    break;
                }
            }
        }
    }
}



int main()
{
    be();
    nagy();
    
    
}

SubtaskSumTestVerdictTimeMemory
base0/50
1Runtime error0/016ms2868 KiB
2Runtime error0/016ms3072 KiB
3Runtime error0/216ms2868 KiB
4Runtime error0/217ms2856 KiB
5Runtime error0/216ms2868 KiB
6Runtime error0/316ms2856 KiB
7Runtime error0/316ms3044 KiB
8Runtime error0/316ms2920 KiB
9Runtime error0/214ms3068 KiB
10Runtime error0/216ms2864 KiB
11Runtime error0/216ms3064 KiB
12Runtime error0/216ms2832 KiB
13Runtime error0/216ms2864 KiB
14Runtime error0/216ms3044 KiB
15Runtime error0/216ms2876 KiB
16Runtime error0/216ms2828 KiB
17Runtime error0/217ms2868 KiB
18Runtime error0/216ms3008 KiB
19Runtime error0/216ms2868 KiB
20Runtime error0/216ms2984 KiB
21Runtime error0/216ms2948 KiB
22Runtime error0/316ms2848 KiB
23Runtime error0/316ms2900 KiB
24Runtime error0/316ms3044 KiB