Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- #define LL long long int
- const LL MOD=1e9+7;
- // When something is important enough, you do it even if the odds are not in your favor.
- int main(){
- ios_base::sync_with_stdio(false);
- cin.tie(NULL);
- #ifdef somujena
- freopen("/home/somujena/competitive/input.txt", "r", stdin);
- freopen("/home/somujena/competitive/output.txt", "w", stdout);
- #endif
- // code goes here
- LL test=1; cin>>test;
- while(test--){
- LL n,i,j;cin>>n;
- set<LL> s;
- while(n--){
- LL x,y;cin>>x>>y;
- if(x==1){
- s.insert(y);
- }
- else{
- LL in=-1;
- auto it=s.lower_bound(y);
- if(it==s.end()) cout<<-1;
- else cout<<*it;
- cout<<endl;
- }
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement