209152026-01-11 11:20:29BikficcTalálkozáscpp17Wrong answer 1/5593ms2356 KiB
#include <iostream>
#include <vector>

using namespace std;

int main()
{
    int n, x, y;
    vector<int> jott(100002,0),ment(100002,0);

    int maxido=0;
    cin>>n;
    for(int i=1; i<=n; i++)
    {
        cin >> x >> y;
        jott[x]++;
        ment[y+1]++;
        maxido=max(maxido, y);
    }
    maxido++;
    for(int i=1; i<=maxido; i++)
    {
        jott[i]=jott[i-1]+jott[i];
        ment[i]=ment[i-1]+ment[i];
    }

    for(int i=1; i<=maxido; i++)
    {
        cout << jott[i] << " ";
    }
    cout << endl;
     for(int i=1; i<=maxido; i++)
    {
        cout << ment[i] << " ";
    }
    cout << endl;
    int lsz= ( n%2==0 ? n/2 : n/2+1);

    int start=1, stop=2;
    int okstart=0, okstop=maxido;
    while (stop <= maxido && start <= stop)
    {
        if(jott[stop]-ment[start]<lsz)
        {
            stop++;
        }
        else
        {
            if (stop-start<okstop-okstart)
            {
                okstop=stop;
                okstart=start;
            }
            start++;
        }
    }
    cout<<okstop-okstart+1<<endl<<okstart<<" "<<okstop;
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base1/55
1Wrong answer0/02ms1076 KiB
2Wrong answer0/092ms2352 KiB
3Wrong answer0/22ms1076 KiB
4Wrong answer0/22ms1076 KiB
5Wrong answer0/22ms1076 KiB
6Wrong answer0/23ms1076 KiB
7Wrong answer0/23ms1076 KiB
8Wrong answer0/33ms1076 KiB
9Wrong answer0/34ms1076 KiB
10Wrong answer0/34ms1132 KiB
11Wrong answer0/317ms1588 KiB
12Wrong answer0/320ms1588 KiB
13Wrong answer0/319ms1592 KiB
14Wrong answer0/326ms1604 KiB
15Wrong answer0/326ms1772 KiB
16Wrong answer0/325ms1588 KiB
17Wrong answer0/326ms1588 KiB
18Wrong answer0/346ms2104 KiB
19Partially correct1/393ms1844 KiB
20Wrong answer0/386ms2240 KiB
21Wrong answer0/393ms2356 KiB
22Wrong answer0/390ms2216 KiB