Pagini recente » Cod sursa (job #895697) | Cod sursa (job #655376) | Cod sursa (job #289672) | Cod sursa (job #2679657) | Cod sursa (job #1669154)
#include <fstream>
#include <algorithm>
#include <vector>
#include <ext/pb_ds/detail/standard_policies.hpp>
#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;
struct cmp {
inline bool operator () (const string &a, const string &b) const {
if(a.size() != b.size()) {
return a.size() < b.size();
}
return a < b;
}
};
tree<
string,
null_type,
cmp,
rb_tree_tag,
tree_order_statistics_node_update>
ordered_set;
ifstream fin("nums.in");
ofstream fout("nums.out");
int main() {
int n;
fin >> n;
for(int i = 1; i <= n; i++) {
int t;
fin >> t;
if(t == 1) {
string s;
fin >> s;
ordered_set.insert(s);
}
else {
int k;
fin >> k;
fout << *ordered_set.find_by_order(k - 1) << '\n';
}
/* for(auto it : ordered_set) {
fout << it << ' ';
}
fout << '\n';*/
}
return 0;
}