Pagini recente » Cod sursa (job #821339) | Cod sursa (job #2262804) | Cod sursa (job #2934768) | Cod sursa (job #2340387) | Cod sursa (job #2633686)
#include <bits/stdc++.h>
using namespace std;
ifstream in("nums.in");
ofstream out("nums.out");
struct number
{
string nr;
bool operator <(number other) const
{
if(nr.size()<other.nr.size()) return true;
if(nr.size()>other.nr.size()) return false;
return nr<other.nr;
}
bool operator >(number other) const
{
if(nr.size()<other.nr.size()) return false;
if(nr.size()>other.nr.size()) return true;
return nr>other.nr;
}
bool operator ==(number other) const
{
return nr==other.nr;
}
};
set<number> s;
int main()
{
int n,tip,k;
number aux;
in>>n;
while(n--)
{
in>>tip;
if(tip==1)
{
in>>aux.nr;
s.insert(aux);
}
else
{
in>>k;
out<<(*(next(s.begin(),k-1))).nr<<'\n';
}
}
return 0;
}