Submission #158737


Source Code Expand

Copy
#include<vector>
#include<cmath>
#include<map>
#include<cstdlib>
#include<iostream>
#include<sstream>
#include<fstream>
#include<string>
#include<algorithm>
#include<cstring>
#include<cstdio>
#include<set>
#include<stack>
#include<bitset>
#include<functional>
#include<ctime>
#include<queue>
#include<deque>
#include<complex>
using namespace std;
#define pb push_back
#define pf push_front
typedef long long lint;
typedef complex<double> P;
#define mp make_pair
#define fi first
#define se second
typedef pair<int,int> pint;
#define All(s) s.begin(),s.end()
#define rAll(s) s.rbegin(),s.rend()
#define REP(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
lint a[100010],ret[100010];
int main()
{
	lint t=0;int n;
	cin>>n;
	rep(i,n) cin>>a[i];
	rep(i,n-1) t^=a[i];
	if(t!=a[n-1]){
		cout<<-1<<endl;return 0;
	}
	ret[0]=0;
	rep(i,n-1) ret[i+1]=ret[i]^a[i];
	rep(i,n) cout<<ret[i]<<endl;
}

Submission Info

Submission Time
Task B - Your Numbers are XORed...
User sky58
Language C++ (G++ 4.6.4)
Score 100
Code Size 940 Byte
Status
Exec Time 486 ms
Memory 3368 KB

Test Cases

Set Name Score / Max Score Test Cases
All 100 / 100 subtask0_sample-01.txt, subtask0_sample-02.txt, subtask0_sample-03.txt, subtask1_01.txt, subtask1_02.txt, subtask1_03.txt, subtask1_04.txt, subtask1_05.txt, subtask1_06.txt, subtask1_07.txt, subtask1_08.txt, subtask1_09.txt, subtask1_10.txt, subtask1_11.txt, subtask1_12.txt, subtask1_13.txt, subtask1_14.txt, subtask1_15.txt, subtask1_16.txt, subtask1_17.txt, subtask1_18.txt, subtask1_19.txt, subtask1_20.txt
Case Name Status Exec Time Memory
subtask0_sample-01.txt 20 ms 920 KB
subtask0_sample-02.txt 20 ms 796 KB
subtask0_sample-03.txt 20 ms 800 KB
subtask1_01.txt 20 ms 804 KB
subtask1_02.txt 21 ms 736 KB
subtask1_03.txt 21 ms 800 KB
subtask1_04.txt 20 ms 924 KB
subtask1_05.txt 20 ms 804 KB
subtask1_06.txt 23 ms 920 KB
subtask1_07.txt 22 ms 928 KB
subtask1_08.txt 20 ms 800 KB
subtask1_09.txt 44 ms 932 KB
subtask1_10.txt 114 ms 1320 KB
subtask1_11.txt 254 ms 2204 KB
subtask1_12.txt 60 ms 1188 KB
subtask1_13.txt 333 ms 2080 KB
subtask1_14.txt 393 ms 2848 KB
subtask1_15.txt 96 ms 1572 KB
subtask1_16.txt 486 ms 3104 KB
subtask1_17.txt 485 ms 3360 KB
subtask1_18.txt 96 ms 1560 KB
subtask1_19.txt 486 ms 3368 KB
subtask1_20.txt 480 ms 3368 KB