80302024-01-12 10:57:44AGergoTalálkozáscpp17Runtime error 3/5571ms12056 KiB
#include <bits/stdc++.h>

using namespace std;

int main()
{
    int vendszam,temp,last,startP,endP;

    cin >> vendszam;

    vector<int> erkezes(100001,0);
    vector<int> tavoz(100001,0);

    for(int i = 0; i < vendszam;i++)
    {
        cin >> temp;
        erkezes[temp]++;
        cin >> temp;
        tavoz[temp+1]++;
        if(temp+1 > last)
        {
            last = temp;
        }
    }
    int H = erkezes[0],v=0,k=0;

    int cel = vendszam/2;
    if(vendszam%2==1)
    {
        cel++;
    }

    while(k!= last)
    {
        if(H < cel)
        {
            v++;
            H += erkezes[v];
            if(v > last+1)
            {
                break;
            }
        }
        else
        {
            k++;
            H -= tavoz[k];
            if(H<cel)
            {
                startP = k-1;
                endP = v;
            }
        }
    }

    cout << endP-startP+1 << endl << startP << " " << endP;

}
SubtaskSumTestVerdictTimeMemory
base3/55
1Runtime error0/04ms3468 KiB
2Wrong answer0/068ms4644 KiB
3Wrong answer0/23ms4616 KiB
4Runtime error0/24ms5040 KiB
5Runtime error0/24ms5256 KiB
6Wrong answer0/24ms5324 KiB
7Wrong answer0/24ms5304 KiB
8Wrong answer0/34ms5524 KiB
9Wrong answer0/34ms5612 KiB
10Runtime error0/34ms5992 KiB
11Wrong answer0/37ms5704 KiB
12Runtime error0/38ms6068 KiB
13Wrong answer0/38ms6000 KiB
14Wrong answer0/314ms6396 KiB
15Runtime error0/314ms6656 KiB
16Wrong answer0/314ms6568 KiB
17Wrong answer0/314ms6764 KiB
18Runtime error0/323ms7540 KiB
19Runtime error0/371ms8744 KiB
20Accepted3/363ms9476 KiB
21Runtime error0/368ms10924 KiB
22Wrong answer0/368ms12056 KiB