Submission #3643481


Source Code Expand

Copy
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define endl '\n'

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    int q;
    cin >> q;
    tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> s;
    while (q--) {
        int t, x;
        cin >> t >> x;
        if (t == 1) {
            s.insert(x);
        } else {
            int k = *s.find_by_order(x - 1);
            cout << k << endl;
            s.erase(k);
        }
    }
}

Submission Info

Submission Time
Task C - データ構造
User xuzijian629
Language C++14 (GCC 5.4.1)
Score 100
Code Size 639 Byte
Status
Exec Time 123 ms
Memory 9600 KB

Test Cases

Set Name Score / Max Score Test Cases
Sample 0 / 0 sample_01.txt, sample_02.txt
All 100 / 100 sample_01.txt, sample_02.txt, subtask1_01.txt, subtask1_02.txt, subtask1_03.txt, subtask1_04.txt, subtask1_05.txt, subtask1_06.txt, subtask1_07.txt, subtask1_08.txt, subtask1_09.txt, subtask1_10.txt, subtask1_11.txt, subtask1_12.txt, subtask1_13.txt, subtask1_14.txt, subtask1_15.txt, subtask1_16.txt
Case Name Status Exec Time Memory
sample_01.txt 1 ms 256 KB
sample_02.txt 1 ms 256 KB
subtask1_01.txt 1 ms 256 KB
subtask1_02.txt 1 ms 256 KB
subtask1_03.txt 1 ms 256 KB
subtask1_04.txt 5 ms 256 KB
subtask1_05.txt 10 ms 384 KB
subtask1_06.txt 1 ms 256 KB
subtask1_07.txt 66 ms 3328 KB
subtask1_08.txt 65 ms 896 KB
subtask1_09.txt 62 ms 896 KB
subtask1_10.txt 117 ms 5248 KB
subtask1_11.txt 118 ms 5248 KB
subtask1_12.txt 122 ms 9600 KB
subtask1_13.txt 123 ms 5632 KB
subtask1_14.txt 123 ms 5632 KB
subtask1_15.txt 118 ms 5632 KB
subtask1_16.txt 88 ms 5248 KB