158232025-03-03 22:08:53rennZenehallgatáscpp17Wrong answer 0/5052ms1376 KiB
#include <bits/stdc++.h>
using namespace std;

#define GOTTAGOFAST cin.tie(0); cout.tie(0); ios::sync_with_stdio(0);

int binkeres(int hossz[], int& dal, int& keres)
{
    static int bal, jobb, mid;
    bal = 0, jobb = dal-1;
    
    while(bal <= jobb)
    {
        mid = bal + (jobb-bal)/2;

        if(hossz[mid] >= keres)
            jobb = mid-1;
        else
            bal = mid+1;
    }
    
    return bal;
}

int main(){
    GOTTAGOFAST

    int dal, ido, curr;
    cin >> dal >> ido;

    int hossz[dal];
    cin >> hossz[0];
    for(int i = 1; i < dal; i++)
    {
        cin >> hossz[i];
        hossz[i] += hossz[i-1];
    }


    while(ido--)
    {
        cin >> curr;
        curr -= hossz[dal-1] * ((curr-1)/hossz[dal-1]);
        cout << binkeres(hossz, dal, curr) << " ";
    }

}
SubtaskSumTestVerdictTimeMemory
base0/50
1Wrong answer0/01ms316 KiB
2Wrong answer0/052ms1332 KiB
3Wrong answer0/21ms316 KiB
4Wrong answer0/21ms316 KiB
5Wrong answer0/21ms316 KiB
6Wrong answer0/31ms316 KiB
7Wrong answer0/31ms316 KiB
8Wrong answer0/31ms496 KiB
9Wrong answer0/252ms1352 KiB
10Wrong answer0/252ms1324 KiB
11Wrong answer0/252ms1332 KiB
12Wrong answer0/252ms1328 KiB
13Wrong answer0/252ms1376 KiB
14Wrong answer0/252ms1332 KiB
15Wrong answer0/252ms1348 KiB
16Wrong answer0/252ms1328 KiB
17Wrong answer0/252ms1332 KiB
18Wrong answer0/250ms1332 KiB
19Wrong answer0/250ms1328 KiB
20Wrong answer0/250ms1332 KiB
21Wrong answer0/250ms1332 KiB
22Wrong answer0/350ms1332 KiB
23Wrong answer0/350ms1336 KiB
24Wrong answer0/350ms1280 KiB