Advertisement
Guest User

JAPC1002 C++ Solution

a guest
May 2nd, 2021
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.83 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2.  
  3. using namespace std;
  4.  
  5. #define LL long long int
  6. const LL MOD=1e9+7;
  7. // When something is important enough, you do it even if the odds are not in your favor.
  8.  
  9. int main(){
  10. ios_base::sync_with_stdio(false);
  11. cin.tie(NULL);
  12. #ifdef somujena
  13. freopen("/home/somujena/competitive/input.txt", "r", stdin);
  14. freopen("/home/somujena/competitive/output.txt", "w", stdout);
  15. #endif
  16. // code goes here
  17. LL test=1; cin>>test;
  18. while(test--){
  19. LL n,i,j;cin>>n;
  20. set<LL> s;
  21. while(n--){
  22. LL x,y;cin>>x>>y;
  23. if(x==1){
  24. s.insert(y);
  25. }
  26. else{
  27. LL in=-1;
  28. auto it=s.lower_bound(y);
  29. if(it==s.end()) cout<<-1;
  30. else cout<<*it;
  31. cout<<endl;
  32. }
  33. }
  34. }
  35. return 0;
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement