Submission #57465466


Source Code Expand

#include <bits/stdc++.h>

using namespace std;

using ll = long long;
using ld = long double;
using pl = pair<ll, ll>;
constexpr ll INF = 1e9 + 7;
constexpr ll mod = 1e9 + 7;
constexpr ld eps = 1e-9;
const ld PI = acos(-1);

int main() {
    cin.tie(nullptr)->sync_with_stdio(false);
    ll n;
    cin >> n;
    vector<array<ll, 3>> a(n);
    for (ll i = 0; i < n; ++i) {
        cin >> a[i][0] >> a[i][1];
        a[i][2] = i;
    }
    sort(a.begin(), a.end());
    vector<ll> ans;
    vector<ll> s;
    for(auto &[x,y,i] : a){
        while(s.size() && s.back() > y)s.pop_back(),ans.pop_back();
        s.push_back(y);
        ans.push_back(i);
    }
    cout << ans.size() << "\n";
    sort(ans.begin(),ans.end());
    for(auto x : ans)cout << x + 1 << " ";
}

Submission Info

Submission Time
Task C - AtCoder Magics
User ZergTricky
Language C++ 20 (gcc 12.2)
Score 350
Code Size 795 Byte
Status AC
Exec Time 39 ms
Memory 11168 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 350 / 350
Status
AC × 3
AC × 17
Set Name Test Cases
Sample 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt
All 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt, 01_hand_00.txt, 01_hand_01.txt, 01_hand_02.txt, 02_random_00.txt, 02_random_01.txt, 02_random_02.txt, 02_random_03.txt, 02_random_04.txt, 02_random_05.txt, 02_random_06.txt, 02_random_07.txt, 02_random_08.txt, 02_random_09.txt, 02_random_10.txt
Case Name Status Exec Time Memory
00_sample_00.txt AC 1 ms 3568 KiB
00_sample_01.txt AC 1 ms 3396 KiB
00_sample_02.txt AC 1 ms 3456 KiB
01_hand_00.txt AC 27 ms 7812 KiB
01_hand_01.txt AC 39 ms 11168 KiB
01_hand_02.txt AC 28 ms 9644 KiB
02_random_00.txt AC 28 ms 7824 KiB
02_random_01.txt AC 27 ms 7668 KiB
02_random_02.txt AC 26 ms 7768 KiB
02_random_03.txt AC 26 ms 7752 KiB
02_random_04.txt AC 27 ms 7776 KiB
02_random_05.txt AC 26 ms 8092 KiB
02_random_06.txt AC 28 ms 7744 KiB
02_random_07.txt AC 28 ms 7668 KiB
02_random_08.txt AC 28 ms 7732 KiB
02_random_09.txt AC 27 ms 7808 KiB
02_random_10.txt AC 27 ms 7828 KiB