Pagini recente » Cod sursa (job #3317538) | Cod sursa (job #3343289) | Cod sursa (job #3307022) | Cod sursa (job #3312764) | Cod sursa (job #3348389)
#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;
struct Cmp{
bool operator () (const string& a,const string& b) const
{
if (a.length()==b.length())
return a<b;
return a.length()<b.length();
}
};
typedef tree<
string,
null_type,
Cmp, // Folosim comparatorul nostru
rb_tree_tag,
tree_order_statistics_node_update> ordered_set;
ordered_set mys;
int n,c,x;
string s;
int main()
{
ifstream f ("nums.in");
ofstream g ("nums.out");
f>>n;
for (int i=1;i<=n;i++)
{
f>>c;
if (c==1)
{
f>>s;
mys.insert(s);
}
else
{
f>>x;
g<<*mys.find_by_order(x-1)<<'\n';
}
}
}