215522026-01-13 13:33:56szjMekk Mester munkái (50 pont)cpp17Wrong answer 0/5093ms2264 KiB
#include <bits/stdc++.h>

using namespace std;
struct ize
{
    int first, second, loc;
};
bool f(ize a, ize b)
{
    if(a.second!=b.second)return a.second<b.second;
    else return a.first<b.first;
}
int main()
{
    int n, h, i, m1=0, m2=0;
    cin >> n >> h;
    vector<ize> vec(n);
    for(i=0; i<n; i++)
    {
        cin >> vec[i].first >> vec[i].second;
        vec[i].loc=i+1;
    }
    sort(vec.begin(), vec.end(), f);
    //for(auto i:vec)cout << i.first << " " << i.second<<endl;
    vector<int>m1m;
    vector<int>m2m;
    for(i=0; i<n; i++)
    {
        if(m1>m2)
        {
            if(vec[i].first>m1)
            {
                m1=vec[i].second;
                m1m.push_back(vec[i].loc);
            }
            else if(vec[i].first>m2)
            {
                m2=vec[i].second;
                m2m.push_back(vec[i].loc);
            }
        }
        else
        {
            if(vec[i].first>m2)
            {
                m2=vec[i].second;
                m2m.push_back(vec[i].loc);
            }
            else if(vec[i].first>m1)
            {
                m1=vec[i].second;
                m1m.push_back(vec[i].loc);
            }
        }
    }
    cout << m1m.size() << " " << m2m.size() <<endl;
    sort(m1m.begin(),m1m.end());
    sort(m2m.begin(),m2m.end());
    for(auto i:m1m)cout << i << " ";
    cout << endl;
    for(auto i:m2m)cout << i << " ";
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base0/50
1Accepted0/02ms500 KiB
2Wrong answer0/08ms548 KiB
3Wrong answer0/11ms568 KiB
4Wrong answer0/12ms316 KiB
5Wrong answer0/21ms316 KiB
6Wrong answer0/21ms316 KiB
7Wrong answer0/21ms316 KiB
8Wrong answer0/22ms316 KiB
9Wrong answer0/32ms316 KiB
10Wrong answer0/12ms316 KiB
11Wrong answer0/12ms316 KiB
12Wrong answer0/22ms388 KiB
13Wrong answer0/22ms316 KiB
14Wrong answer0/22ms316 KiB
15Wrong answer0/22ms316 KiB
16Wrong answer0/32ms316 KiB
17Wrong answer0/279ms1584 KiB
18Wrong answer0/279ms1580 KiB
19Wrong answer0/479ms1780 KiB
20Wrong answer0/479ms1584 KiB
21Wrong answer0/481ms1588 KiB
22Wrong answer0/482ms1588 KiB
23Wrong answer0/493ms2264 KiB