-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathC.Magic Formula - Codeforces Round 242 (Div. 2).cpp
113 lines (81 loc) · 1.99 KB
/
C.Magic Formula - Codeforces Round 242 (Div. 2).cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
// std::setvbuf(stdout, nullptr, _IOFBF, BUFSIZ); //(will neglect the c's stdio.h property of doing inline flushing with every line of code)
//std::ios_base::sync_with_stdio(false); // (removes the interoperability that happens between C's stdio.h and iostream )
#include <iostream>
//#include<numeric>
//#include<vector>
//#include<cmath>
//#include<stack>
//#include <iomanip>
//#include <vector>
#include<bits/stdc++.h>
//#include <bitset>
////#include<iomanip>
//#include <algorithm>
//#include<queue>
////#include<deque>
////#include<numeric>
//#include<set>
//#include<unordered_set>
//#include<map>
////#include<fstream>
//#include<sstream>
////#include <thread>
////#include <chrono>
//#include<cstring>
//#include<string>
//#include <unordered_map>
////#include <thread>
////#include<limits>
//
using namespace std;
int arr[1000002]{0};
int repeatitiveXOR(int x ,int portionCnt){
if(portionCnt%2)
return x;
return 0;
}
int getall(int n){
int x=0;
int res=0;
for(int i=1;i<=n;++i){
arr[i] = x;
int portionCnt= (n-i+1)/i;
res^=repeatitiveXOR(x,portionCnt);
int portionremainCnt=(n-i+1)%i;
res^=arr[portionremainCnt];
res^=repeatitiveXOR(i,n-i);
x^=i;
}
return res;
}
long long r,m,l
pair<int,int> binarySearchOnTriples(int s,int comp,int other1,int other2){
long long mid,midp,start=1,last=10e9+2;
while(start<last){
mid = (start+last)/2;
midp =mid+1;
l = (midp*midp - (mid*mid));
m = s*mid*midp;
r = (midp*midp + (mid*mid));
if(comp==s)return {other1 ,other2};
else if (comp<s) start =mid;
else last = mid;
}
}
int main(){
int n;
cin>>n;
long long res =getall(n);
for(int i =1;i<=n;++i){
long long temp;
cin>>temp;
res^=temp;
}
cout<<res;
cout<<(65535^0^1^0^0^0);
for(int n =1;n<=20;++n){
func(n);
cout<<"\n----\n";
}
func(20);
}