Pagini recente » Cod sursa (job #2187585) | Cod sursa (job #1675949) | Clasament FMI No Stress 2012 | Cod sursa (job #222335) | Cod sursa (job #1878774)
/*
Pur si simplu: GENIAL
Inspirat dupa: http://www.infoarena.ro/job_detail/1837619?action=view-source
*/
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds;
fstream in ( "nums.in" , ios::in );
fstream out( "nums.out", ios::out );
template <class key_type>
using super_tree = tree<key_type, null_type,
less<key_type>, rb_tree_tag, tree_order_statistics_node_update>;
string str;
super_tree< pair<int, string> > mst;
int main() {
ios::sync_with_stdio( false );
int n;
in >> n;
for( int i = 1; i <= n; i ++ ) {
int x, k;
in >> x;
switch( x ) {
case 1:
in >> str;
mst.insert( make_pair( str.length(), str ) );
break;
case 0:
in >> k;
out << ( *mst.find_by_order( k - 1 ) ).second << "\n";
break;
}
}
return 0;
}