158202025-03-03 21:31:01rennZenehallgatáscpp17Wrong answer 0/5052ms1356 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;
    
    while(bal < jobb)
    {
        mid = bal + (jobb-bal)/2;

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

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];
        cout << binkeres(hossz, dal, curr) << " ";
    }

}
SubtaskSumTestVerdictTimeMemory
base0/50
1Accepted0/01ms316 KiB
2Wrong answer0/052ms1332 KiB
3Wrong answer0/21ms316 KiB
4Wrong answer0/21ms316 KiB
5Wrong answer0/21ms316 KiB
6Wrong answer0/31ms424 KiB
7Wrong answer0/31ms316 KiB
8Wrong answer0/31ms316 KiB
9Wrong answer0/250ms1276 KiB
10Wrong answer0/252ms1184 KiB
11Wrong answer0/252ms1276 KiB
12Wrong answer0/252ms1332 KiB
13Wrong answer0/250ms1316 KiB
14Wrong answer0/250ms1316 KiB
15Wrong answer0/250ms1332 KiB
16Wrong answer0/250ms1276 KiB
17Wrong answer0/250ms1352 KiB
18Wrong answer0/250ms1172 KiB
19Wrong answer0/250ms1332 KiB
20Wrong answer0/248ms1148 KiB
21Wrong answer0/248ms1212 KiB
22Wrong answer0/348ms1336 KiB
23Wrong answer0/348ms1200 KiB
24Wrong answer0/348ms1356 KiB