Pagini recente » Cod sursa (job #730116) | Cod sursa (job #1396848) | Cod sursa (job #353726) | Cod sursa (job #2535828) | Cod sursa (job #2175987)
# include <iostream>
# include <fstream>
# include <string>
# include <ext/pb_ds/assoc_container.hpp>
# include <ext/pb_ds/tree_policy.hpp>
# include <bits/stdc++.h>
using namespace std;
using namespace __gnu_pbds;
int main()
{
ifstream f("nums.in");
ofstream g("nums.out");
tree<pair<int, string>, null_type, less<pair<int, string> >, rb_tree_tag, tree_order_statistics_node_update> v;
int n,tip,k;
f>>n;
for (int i=1;i<=n;i++)
{
f>>tip;
if (tip==1)
{
string str;
f>>str;
v.insert({str.size(),str});
} else {
f>>k;
g<<v.find_by_order(k-1)->second<< '\n';
}
}
return 0;
}