Cod sursa(job #1837619)

Utilizator tamionvTamio Vesa Nakajima tamionv Data 30 decembrie 2016 04:58:55
Problema Nums Scor 100
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.68 kb
#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;
 
template <typename key_type>
using super_tree = tree<key_type, null_type,
    less<key_type>, rb_tree_tag, tree_order_statistics_node_update>;
 
int main(){
    ifstream f("nums.in");
    ofstream g("nums.out");
    int n, t, x;
    string str;
    f >> n;
    super_tree<pair<int, string>> st;
    while(n--){
        f >> t;
        if(t == 0){
            f >> x;
            g << st.find_by_order(x-1)->second << '\n'; }
        else{
            f >> str;
            st.insert(make_pair(str.size(), move(str))); } }
 
    return 0; }