Advertisement
Emiliatan

e319 - 2

Jul 22nd, 2019
136
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.47 KB | None | 0 0
  1. /* e319 - 2         */
  2. /* AC (0.3s, 116KB) */
  3. #pragma warning( disable : 4996 )
  4. #include <cstdio>
  5. #include <cstdint>
  6. using namespace std;
  7.  
  8. using int16 = int_fast16_t;
  9. using int32 = int_fast32_t;
  10. using int64 = int_fast64_t;
  11.  
  12. /* main code */
  13. int32 N, result = 0, a, b, c, x;
  14.  
  15. int main()
  16. {
  17.     scanf("%d", &N);
  18.     a = b = c = 0;
  19.     while (N-- && scanf("%d", &x))
  20.     {
  21.         c = x & b;
  22.         b &= ~x;
  23.         x &= ~c;
  24.         b |= a & x;
  25.         a ^= x;
  26.     }
  27.     printf("%d", a);
  28.  
  29.     return 0;
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement