Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #pragma GCC optimize("O3")
- #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
- #pragma comment(linker, "/stack:200000000")
- #include<ios>
- char buf[1<<17],*p1=buf,*p2=buf;
- inline int getc(){
- return p1==p2&&(p2=(p1=buf)+fread_unlocked(buf,1,1<<17,stdin),p1==p2)?EOF:*p1++;
- }
- inline void write(int x) {
- static int stk[9],top=0;
- int *ptr;
- ptr = &stk[0];
- while(x){*ptr=x%10;x/=10;ptr++;}
- ptr--;
- while(ptr>=(&stk[0])){putchar_unlocked(*ptr+'0');ptr--;}
- }
- inline int read() {
- int ret=0;
- char ch=getc();
- while(ch>='0'&&ch<='9')
- ret=(ret<<1)+(ret<<3)+ch-'0',ch=getc();
- return ret;
- }
- int main(){
- int n,p=0,q=0,b;
- n=read();
- for(int i=0;i<n;i++){
- b=read();
- p=q&(p^b);
- q=p|(q^b);
- }
- write(q);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement