fork download
  1. #include <iostream>
  2. using namespace std;
  3. const int maxN = 1e6+5;
  4.  
  5. int n, a[maxN];
  6.  
  7. int main() {
  8. // your code goes here
  9. cin>>n;
  10. for(int i=1; i<=n; i+=1)
  11. {
  12. cin>>a[i];
  13. }
  14. for(int i=1; i<=n; i+=1) cout<<a[i]<<" "; cout<<'\n';
  15. for(int i=1; i<=n; i+=1) cout<<(a[i]^a[i+1])<<" "; cout<<'\n';
  16. return 0;
  17. }
Success #stdin #stdout 0.01s 5296KB
stdin
9
1 0 1 0 1 0 1 0 1 0 1
stdout
1 0 1 0 1 0 1 0 1 
1 1 1 1 1 1 1 1 1