84552024-01-16 18:50:22bovizdbMekk Mester munkái (50 pont)cpp17Elfogadva 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;
}
RészfeladatÖsszpontTesztVerdiktIdőMemória
base50/50
1Elfogadva0/03ms1976 KiB
2Elfogadva0/06ms2276 KiB
3Elfogadva1/13ms2132 KiB
4Elfogadva1/13ms2212 KiB
5Elfogadva2/23ms2340 KiB
6Elfogadva2/23ms2428 KiB
7Elfogadva2/23ms2584 KiB
8Elfogadva2/23ms2648 KiB
9Elfogadva3/33ms2648 KiB
10Elfogadva1/13ms2672 KiB
11Elfogadva1/13ms2860 KiB
12Elfogadva2/23ms2868 KiB
13Elfogadva2/23ms2948 KiB
14Elfogadva2/23ms3128 KiB
15Elfogadva2/23ms3460 KiB
16Elfogadva3/33ms3684 KiB
17Elfogadva2/245ms8392 KiB
18Elfogadva2/243ms8352 KiB
19Elfogadva4/445ms8400 KiB
20Elfogadva4/445ms8480 KiB
21Elfogadva4/446ms8740 KiB
22Elfogadva4/446ms9532 KiB
23Elfogadva4/452ms10708 KiB