67282023-12-18 11:51:14szasztundeTalálkozáscpp17Wrong answer 0/55114ms65020 KiB
#include <iostream>
#include <set>

using namespace std;

int main()
{
    unsigned n;
    cin >> n;

    unsigned x, y, _max=0;
    set<int> halmaz[10001];
    set<int> koz;

    for(unsigned i=1; i<=n; i++) {
        cin >> x >> y;
        for(unsigned k=x; k<=y; k++) {
            halmaz[k].insert(i);
        }
        if(y>_max) {
            _max=y;
        }
    }

    unsigned z, lep, _min=1000, e, t, k, v, vmax, vissza=_max;
    while(z>=1) {
        vmax=0;
        z=vissza;
        v=z;
        lep=0;
        while(koz.size()<n/2 && z>=1) {
            if(halmaz[z].size()>=vmax) {
                vmax=halmaz[z].size();
                vissza=z;
            }
            koz.insert(halmaz[z].begin(), halmaz[z].end());
            z--;
            lep++;
        }
        if(vissza==v) {
            vissza=z+1;
        }
        k=z+1;
        if(lep<_min) {
            _min=lep;
            e=k;
            t=v;
        }
        koz.clear();
    }

    cout << _min << endl << e << " " << t;

    return 0;
}
SubtaskSumTestVerdictTimeMemory
base0/55
1Wrong answer0/03ms2532 KiB
2Runtime error0/083ms65020 KiB
3Wrong answer0/23ms3048 KiB
4Wrong answer0/23ms3236 KiB
5Wrong answer0/23ms3448 KiB
6Wrong answer0/24ms4748 KiB
7Wrong answer0/26ms6736 KiB
8Wrong answer0/34ms4644 KiB
9Wrong answer0/34ms5064 KiB
10Runtime error0/36ms7064 KiB
11Runtime error0/330ms30472 KiB
12Runtime error0/348ms46024 KiB
13Runtime error0/386ms63544 KiB
14Runtime error0/390ms63296 KiB
15Runtime error0/394ms63288 KiB
16Runtime error0/386ms63048 KiB
17Runtime error0/389ms62952 KiB
18Runtime error0/3114ms62720 KiB
19Runtime error0/34ms6172 KiB
20Runtime error0/34ms6168 KiB
21Runtime error0/375ms62584 KiB
22Runtime error0/356ms54700 KiB