Cod sursa(job #2311509)

Utilizator NeredesinI am not real Neredesin Data 3 ianuarie 2019 12:47:28
Problema Nums Scor 100
Compilator cpp-64 Status done
Runda Arhiva de probleme Marime 0.57 kb
#include <iostream>
#include <fstream>
#include <cstring>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
typedef tree < pair < int, string >, null_type, less < pair < int, string > >, rb_tree_tag, tree_order_statistics_node_update > a;
ifstream f("nums.in");
ofstream g("nums.out");
int n,p,x;
string s;
a t;
int main(){
  f>>n;
  for(int i=1;i<=n;i++){
    f>>p;
    if(p==0) {f>>x;g<<t.find_by_order(x - 1)->second<<'\n';}
    else{f>>s;t.insert({s.size(),s});}
  }
  return 0;
}