fork download
  1. /// WHAT I CAN NOT CREATE , I DO NOT UNDERSTAND
  2. #include <bits/stdc++.h>
  3. using namespace std;
  4. typedef long long ll;
  5. typedef double db;
  6. typedef long double ld;
  7. typedef pair<int, int> pii;
  8. typedef pair<ll, ll> pll;
  9. typedef vector<int> vi;
  10. typedef vector<ll> vll;
  11. typedef vector<db> vd;
  12. typedef vector<ld> vld;
  13. typedef vector<bool> vb;
  14. typedef vector<vector<ll>> vvl;
  15. typedef vector<vector<int>> vvi;
  16. typedef vector<pii> vii;
  17. typedef set<int> si;
  18. typedef set<ll> sl;
  19. #define pb push_back
  20. #define pf push_front
  21. #define popb pop_back
  22. #define popf pop_front
  23. #define fi first
  24. #define se second
  25. #define all(x) x.begin(), x.end()
  26. #define rall(x) x.rbegin(), x.rend()
  27. #define endl "\n"
  28. const int MOD = 998244353, mod = 1e9 + 7, maxA = 1e5 + 5;
  29. #define time cerr << "Time Taken: " << (float)clock() / CLOCKS_PER_SEC << " Secs";
  30. //*===================>>>FastIO - FileIO<<<=========
  31. void fastIO()
  32. {
  33. ios_base::sync_with_stdio(false);
  34. cin.tie(nullptr);
  35. cout.tie(nullptr);
  36. }
  37. void fileIO()
  38. {
  39. #ifndef ONLINE_JUDGE
  40. freopen("in.txt", "r", stdin);
  41. freopen("out.txt", "w", stdout);
  42. #endif
  43. }
  44.  
  45. void Blablabla()
  46. {
  47. int n, q;
  48. cin >> n >> q;
  49.  
  50. vector<vector<int>> v(n);
  51.  
  52. while (q--)
  53. {
  54. int op, idx;
  55. cin >> op >> idx;
  56.  
  57. if (op == 0)
  58. {
  59. int x;
  60. cin >> x;
  61.  
  62. v[idx].push_back(x);
  63. }
  64.  
  65. else if (op == 1)
  66. {
  67. for (int i = 0; i < v[idx].size(); i++)
  68. {
  69. if(i > 0)
  70. {
  71. cout << " ";
  72. }
  73. cout << v[idx][i];
  74. }
  75. cout << endl;
  76. }
  77.  
  78. else if (op == 2)
  79. {
  80. v[idx].clear();
  81. }
  82. }
  83. }
  84.  
  85. int main()
  86. {
  87. fastIO();
  88. // fileIO();
  89.  
  90. ll tc = 1, t = 1;
  91. // cin >> t;
  92. while (t--)
  93. {
  94. // cout << "Case " << tc++ << ": ";
  95. Blablabla();
  96. }
  97. // time;
  98. return 0;
  99. }
  100.  
Success #stdin #stdout 2.99s 5320KB
stdin
Standard input is empty
stdout
Standard output is empty