Advertisement
leminhkt

84

Oct 24th, 2020
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.46 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4.  
  5.  
  6. typedef long long ll;
  7. #define x first
  8. #define y second
  9. #define Exit(x) { x; return; }
  10. #define debug(a, b) '(' << a << " = " << b << ')'
  11. ll gll() { ll x; return cin >> x, x; }
  12. int gint() { int x; return cin >> x, x; }
  13. string gstr() { string x; return cin >> x, x; }
  14. struct custom_hash {
  15.     static uint64_t splitmix64(uint64_t x) {
  16.         x += 0x9e3779b97f4a7c15;
  17.         x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
  18.         x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
  19.         return x ^ (x >> 31);
  20.     }
  21.  
  22.     size_t operator()(uint64_t x) const {
  23.         static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
  24.         return splitmix64(x + FIXED_RANDOM);
  25.     }
  26. };
  27.  
  28.  
  29.  
  30.         /* ------- declaration ------- */
  31.  
  32.     int x;
  33.     unordered_map<int, bool, custom_hash> m;
  34.  
  35. /* ------- ~~~~~~~~~~~ ------- */
  36.  
  37.  
  38.  
  39.         /* ----------------- main func ----------------- */
  40.  
  41.     void query() {
  42.         for (; cin >> x; m[x] = true)
  43.             if (m[x]) Exit(cout << x);
  44.     }
  45.  
  46. /* ----------------- ~~~~~~~~~ ----------------- */
  47.  
  48.  
  49.  
  50. int main(){
  51.     //freopen("Test.INP", "r", stdin);
  52.     //freopen("Test.OUT", "w", stdout);
  53.     cin.tie(NULL)->sync_with_stdio(false);
  54.  
  55.         /* ------- setup ------- */
  56.  
  57.     srand(time(0));
  58.     cout << fixed << setprecision(2);
  59.     int t = 1; for (; t--; query());
  60.  
  61. /* ------- ~~~~~ ------- */
  62.  
  63.     return 0;
  64. }
  65.  
  66.  
  67.  
  68.         /* ------- ~~~~~~~ -------
  69.  
  70.    
  71.  
  72. ------- ~~~~~~~ ------- */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement