Advertisement
aayyk

Untitled

Nov 18th, 2020
462
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.54 KB | None | 0 0
  1. //#pragma GCC optimize("Ofast,unroll-loops")
  2.  
  3. #ifdef LOCAL
  4. #include "debug.h"
  5. #else
  6. #include <bits/stdc++.h>
  7. #include <ext/pb_ds/assoc_container.hpp>
  8. #include <ext/pb_ds/tree_policy.hpp>
  9. #define debug(x...)
  10. #endif
  11.  
  12. using namespace std;
  13.  
  14. //#define int ll
  15.  
  16. typedef long long ll;
  17. typedef long double ld;
  18. typedef pair <int, int> pii;
  19. #define sz(x) int((x).size())
  20.  
  21. template <typename T>
  22. using ordered_set = __gnu_pbds::tree <T, __gnu_pbds::null_type, less<T>, __gnu_pbds::rb_tree_tag, __gnu_pbds::tree_order_statistics_node_update>;
  23.  
  24. #ifdef ONLINE_JUDGE
  25. mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
  26. #else
  27. mt19937 rng(1000 - 7);
  28. #endif
  29.  
  30. const int N = 2e5 + 10;
  31. //const ll MOD = 998244353;
  32. const ll MOD = 1e9 + 7;
  33. const ld eps = 5e-8;
  34. const pii dir[] = { { 0, 1 }, { 0, -1 }, { 1, 0 }, { -1, 0 } };
  35.  
  36.  
  37.  
  38. signed main() {
  39. #ifdef LOCAL
  40.     freopen("input.txt", "r", stdin);
  41.     freopen("output.txt", "w", stdout);
  42. #endif
  43.     cout << fixed << setprecision(9);
  44.     ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  45.  
  46.     int n;
  47.     cin >> n;
  48.  
  49.     vector <int> a(n);
  50.     for (int& x : a) {
  51.         cin >> x;
  52.     }
  53.  
  54.     int x, y, ans = 0;
  55.     for (int i = 0; i < n; i++) {
  56.         for (int j = 1; j < n; j++) {
  57.             if (a[i] > a[j]) {
  58.                 if ((a[i] + a[j]) % 120 == 0 && a[i] + a[j] > ans) {
  59.                     x = a[i], y = a[j];
  60.                     ans = a[i] + a[j];
  61.                 }
  62.             }
  63.         }
  64.     }
  65.  
  66.     cout << x << " " << y << endl;
  67.  
  68.     return 0;
  69. }
  70.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement