Pagini recente » Cod sursa (job #1441961) | Cod sursa (job #1439857) | Cod sursa (job #1663777) | Cod sursa (job #3147525) | Cod sursa (job #3038034)
#include <fstream>
#include <set>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
template<class T> using oset = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
oset<pair<int, string>> s;
int main()
{
ifstream cin("nums.in");
ofstream cout("nums.out");
int q;
cin >> q;
while (q--)
{
int t;
cin>>t;
if (t == 0)
{
int p;
cin>>p;
cout<<((s.find_by_order(p - 1))->second)<<"\n";
}
else
{
string k;
cin>>k;
s.insert({k.size(), k});
}
}
return 0;
}