immuntasir

Untitled

Sep 20th, 2015
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.52 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2.  
  3. using namespace std;
  4.  
  5. typedef long long LL;
  6. #define PII pair<int,int>
  7. #define PLL pair<LL,LL>
  8. #define VI vector<int>
  9. #define VL vector<LL>
  10. #define VPII vector<PII>
  11. #define VPLL vector<PLL>
  12. #define MII map<int,int>
  13. #define MSI map<string,int>
  14. #define MIS map<int,string>
  15. #define MLL map<LL,LL>
  16. #define SI set<int>
  17. #define SL set<LL>
  18. #define SS set<string>
  19. #define SSS multiset<string>
  20. #define LINE printf("\n")
  21. #define SYNC ios_base::sync_with_stdio(0)
  22. #define debug puts("here")
  23. #define PI acos(-1)
  24. #define all(x) ((x).begin(),(x).end())
  25. #define reset(x, val) memset((x),val,sizeof((x)))
  26. #define forl(i, s, n) for(int (i) = (s); i < (n); (i)++)
  27. #define fore(i, s, n) for(int (i) = (s); i <= (n); (i)++)
  28. #define fi first
  29. #define se second
  30. #define pb push_back
  31. LL gcd(LL x, LL y) {return y == 0? x : gcd(y, x % y);}
  32. LL lcm(LL x, LL y) {return (x * y) / gcd(x, y);}
  33. bool is_prime(int x) {
  34. if(x == 2) return true;
  35. if(x % 2 == 0) return false;
  36. int sq = sqrt(x);
  37. for(int i = 3; i <= sq; i += 2) {
  38. if(x % i == 0) return false;
  39. }
  40. return true;
  41. }
  42.  
  43. const LL MOD = (LL)1e9 + 7;
  44. const int MAXN = 1e6 + 10;
  45.  
  46. int main() {
  47. SYNC;
  48. SSS table;
  49. string s;
  50. int N, type, num, T;
  51. cin >> T;
  52. while(T--) {
  53. cin >> N;
  54. table.clear();
  55. while(N--) {
  56. cin >> type;
  57. if(type) {
  58. cin >> num;
  59. num--;
  60. SSS :: iterator it = table.begin();
  61. std:: advance(it, num);
  62. cout << *it << '\n';
  63. } else {
  64. cin >> s;
  65. table.insert(s);
  66. }
  67. }
  68. }
  69. return 0;
  70. }
Advertisement
Add Comment
Please, Sign In to add comment