80602024-01-12 11:44:23AGergoTalálkozáscpp17Runtime error 1/5570ms5908 KiB
#include <bits/stdc++.h>

using namespace std;

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

    cin >> vendszam;

    vector<int> erkezes(100002,0);
    vector<int> tavoz(100002,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
base1/55
1Accepted0/03ms3316 KiB
2Runtime error0/068ms3804 KiB
3Runtime error0/23ms3900 KiB
4Partially correct1/23ms3820 KiB
5Runtime error0/23ms4276 KiB
6Runtime error0/24ms4488 KiB
7Runtime error0/24ms4728 KiB
8Wrong answer0/33ms4484 KiB
9Wrong answer0/33ms4616 KiB
10Wrong answer0/33ms4696 KiB
11Runtime error0/37ms5044 KiB
12Wrong answer0/38ms4976 KiB
13Runtime error0/38ms5308 KiB
14Runtime error0/314ms5440 KiB
15Runtime error0/314ms5692 KiB
16Wrong answer0/314ms5288 KiB
17Runtime error0/314ms5556 KiB
18Runtime error0/323ms5664 KiB
19Wrong answer0/370ms5384 KiB
20Runtime error0/361ms5908 KiB
21Runtime error0/370ms5680 KiB
22Runtime error0/367ms5580 KiB