# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
67974 | 2018-08-15T16:19:01 Z | hamzqq9 | XOR Sum (info1cup17_xorsum) | C++14 | 3 ms | 476 KB |
#include<bits/stdc++.h> #define st first #define nd second #define pb push_back #define ppb pop_back #define umax(x,y) x=max(x,y) #define umin(x,y) x=min(x,y) #define ll long long #define ii pair<int,int> #define iii pair<int,ii> #define sz(x) ((int) x.size()) #define orta ((bas+son)>>1) #define all(x) x.begin(),x.end() #define dbgs(x) cerr<<(#x)<<" --> "<<(x)<<" " #define dbg(x) cerr<<(#x)<<" --> "<<(x)<<endl;getchar() #define pw(x) (1<<(x)) #define inf 1000000000000000000 #define MOD 1000000007 #define N 1000006 #define MAX 10000006 #define LOG 30 using namespace std; int n,ans,a[N]; vector<ii> v; int main() { freopen("input.txt","r",stdin); scanf("%d",&n); for(int i=1;i<=n;i++) { scanf("%d",&a[i]); v.pb({a[i]&1,i}); } sort(all(v)); for(int i=0;i<LOG;i++) { int bas=n,son=n-1; int ok=0; for(int j=0;j<n;j++) { while(son>=0 && v[son].st+v[j].st>pw(i+1)-1) son--; while(bas-1>=0 && v[bas-1].st+v[j].st>=pw(i)) bas--; ok^=max(0,(son-max(j,bas)+1))&1; } bas=n,son=n-1; for(int j=0;j<n;j++) { while(son>=0 && v[son].st+v[j].st>pw(i+2)-2) son--; while(bas-1>=0 && v[bas-1].st+v[j].st>=pw(i+1)+pw(i)) bas--; ok^=max(0,(son-max(j,bas)+1))&1; } if(ok) ans+=pw(i); vector<ii> v2; for(int j=0;j<n;j++) if(!(a[v[j].nd]&pw(i+1))) v2.pb(v[j]); for(int j=0;j<n;j++) if(a[v[j].nd]&pw(i+1)) v2.pb({v[j].st+pw(i+1),v[j].nd}); v=v2; } printf("%d",ans); }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 3 ms | 376 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 3 ms | 476 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 3 ms | 476 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 3 ms | 376 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 3 ms | 376 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |