fork download
  1. /*
  2. * Language: Standard C++20 [-std=c++20]
  3. * Codeforces : @zvwg.vx & @orzryune
  4. */
  5.  
  6. #pragma GCC optimize("fast-math,O3")
  7. #pragma GCC optimize("no-stack-protector")
  8. #pragma GCC optimize("unroll-loops")
  9. // #pragma GCC optimize("Ofast")
  10. // #pragma GCC target("tune=native")
  11. // #pragma GCC target("avx,avx2,fma")
  12.  
  13. #include <bits/stdc++.h>
  14.  
  15. #if LOCAL
  16. #include <algo/debug.h>
  17. #endif
  18.  
  19. using namespace std;
  20.  
  21. #define el cout << '\n'
  22. #define rt return
  23. #define ll long long
  24. #define ull unsigned long long
  25. #define vec vector
  26. #define bs bitset
  27. #define ust unordered_set
  28. #define ump unordered_map
  29. #define priq priority_queue
  30.  
  31. template <typename T> T lcm(T a, T b) { rt a * (b / __gcd(a, b)); }
  32. template <typename T> double lg(T a, T b) { rt log(b) / log(a); }
  33. template <typename T> void maximize(T& a, T b) { if (a < b) a = b; }
  34. template <typename T> void minimize(T& a, T b) { if (a > b) a = b; }
  35. template <typename T> ull P(T n, T k) { ull res = 1; for (int i = 0; i < k; i++) res *= (n - i); rt res; }
  36. template <typename T> ull C(T n, T k) { ull res = 1; for (int i = 1; i <= k; i++) res = res * (n - i + 1) / i; rt res; }
  37.  
  38. const int limit = 1e6;
  39. const int infi = 1e9;
  40. const int mod = 1e9 + 7;
  41.  
  42. void open_file(const string& file) {
  43. if (file == "-1") rt;
  44. freopen((file + ".inp").c_str(), "r", stdin);
  45. freopen((file + ".out").c_str(), "w", stdout);
  46. }
  47.  
  48. struct value {
  49. string sub;
  50. ll pts;
  51. };
  52.  
  53. bool compare(value a, value b) {
  54. rt a.pts <= b.pts;
  55. }
  56. signed main() {
  57. cin.tie(nullptr), cout.tie(nullptr)
  58. -> ios_base::sync_with_stdio(false);
  59.  
  60. #ifndef ONLINE_JUDGE
  61. srand(time(nullptr));
  62. open_file("sol");
  63. #endif
  64.  
  65. int n;
  66. cin >> n;
  67.  
  68. vec<value> arr(n);
  69. for (auto& [x, y] : arr) cin >> x >> y;
  70.  
  71. sort(arr.begin(), arr.end(), compare);
  72.  
  73. for (auto [x, y] : arr) {
  74. cout << x << ' ' << y; el;
  75. }
  76.  
  77. el;
  78. rt 0;
  79. }
Success #stdin #stdout 0.01s 5288KB
stdin
Standard input is empty
stdout