比赛 EYOI暨SBOI暑假快乐赛5th 评测结果 AAAAAAAAAA
题目名称 AND Sorting 最终得分 100
用户昵称 遥时_彼方 运行时间 0.000 s
代码语言 C++ 内存使用 0.00 MiB
提交时间 2022-06-29 11:13:29
显示代码纯文本
  1. #include<bits/stdc++.h>
  2. #define rep(x,y,z) for(int x=y;x<=z;x++)
  3. #define drep(x,y,z) for(int x=y;x>=z;x--)
  4. #define ull unsigned long long
  5. #define ll long long
  6. using namespace std;
  7. inline int read()
  8. {
  9. int x=0;bool flag=1;char ch=getchar();
  10. while(ch<'0'||ch>'9') {if(ch=='-')flag=0;ch=getchar();}
  11. while(ch>='0'&&ch<='9') {x=(x<<3)+(x<<1)+ch-'0';ch=getchar();}
  12. if(flag) return x;
  13. return ~(x-1);
  14. }
  15. inline void write(int x)
  16. {
  17. if(x<0) {x=~(x-1);putchar('-');}
  18. if(x>9) write(x/10);
  19. putchar(x%10+'0');
  20. }
  21. /////////////////////////
  22. const int N=2e5+50;
  23. int tc,nc;
  24. int ans;
  25. inline void solve()
  26. {
  27. ans=(1<<30)-1;
  28. nc=read();
  29. int s1;
  30. rep(i,0,nc-1)
  31. {
  32. s1=read();
  33. if(s1!=i) ans&=(s1&i);
  34. }
  35. cout<<ans<<endl;
  36. }
  37. int main()
  38. {
  39. freopen("and_sorting.in","r",stdin);
  40. freopen("and_sorting.out","w",stdout);
  41. tc=read();
  42. rep(i,1,tc) solve();
  43. return 0;
  44. }
  45.  
  46.  
  47.  
  48.  
  49.  
  50.  
  51.  
  52.  
  53.  
  54.  
  55.  
  56.  
  57.  
  58.  
  59.