84552024-01-16 18:50:22bovizdbMekk Mester munkái (50 pont)cpp17Accepted 50/5052ms10708 KiB
#include <bits/stdc++.h>
 
using namespace std;
 
#define ll long long
#define endl "\n"
#define pll pair<ll, ll>
#define fs first
#define sc second
#define vll vector<ll>
#define v2d vector<vector<ll>>
#define vpll vector<pll>
#define qll queue<ll>
#define stll stack<ll>
#define sll set<ll>
#define mll map<ll, ll>

struct st
{
    ll k;
    ll v;
    ll i;
};

bool sorting(st a, st b)
{
    return (a.v < b.v);
}

ll n, m;
vector<st> v;

void solve()
{
    cin >> n >> m;
    v.resize(n);
    for (ll i = 0; i < n; i++)
    {
        cin >> v[i].k >> v[i].v;
        v[i].i = i;
    }
    sort(v.begin(), v.end(), sorting);
    vll m1, m2;
    for (ll i = 0; i < n; i++)
    {
        if (m1.size() == 0) m1.push_back(i);
        else if (v[i].k > v[m1[m1.size()-1]].v)
        {
            if (m2.size() > 0 && v[i].k > v[m2[m2.size()-1]].v && v[m2[m2.size()-1]].v > v[m1[m1.size()-1]].v) m2.push_back(i);
            else m1.push_back(i);
        }
        else if (m2.size() == 0) m2.push_back(i);
        else if (v[i].k > v[m2[m2.size()-1]].v) m2.push_back(i);
    }
    cout << m1.size() << " " << m2.size() << endl;
    for (ll i : m1) cout << v[i].i+1 << " ";
    cout << endl;
    for (ll i : m2) cout << v[i].i+1 << " ";
}
 
signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    ll t = 1;
    //cin >> t;
    while(t--)
    {
        solve();
    }
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base50/50
1Accepted0/03ms1976 KiB
2Accepted0/06ms2276 KiB
3Accepted1/13ms2132 KiB
4Accepted1/13ms2212 KiB
5Accepted2/23ms2340 KiB
6Accepted2/23ms2428 KiB
7Accepted2/23ms2584 KiB
8Accepted2/23ms2648 KiB
9Accepted3/33ms2648 KiB
10Accepted1/13ms2672 KiB
11Accepted1/13ms2860 KiB
12Accepted2/23ms2868 KiB
13Accepted2/23ms2948 KiB
14Accepted2/23ms3128 KiB
15Accepted2/23ms3460 KiB
16Accepted3/33ms3684 KiB
17Accepted2/245ms8392 KiB
18Accepted2/243ms8352 KiB
19Accepted4/445ms8400 KiB
20Accepted4/445ms8480 KiB
21Accepted4/446ms8740 KiB
22Accepted4/446ms9532 KiB
23Accepted4/452ms10708 KiB