Last active
March 12, 2017 21:52
-
-
Save mikebsg01/fc554ae373988bef5aad to your computer and use it in GitHub Desktop.
Entrenamiento IOI - Etapa #2 - Problem: Industrial Nim - Judge: Codeforces - 09/01/2015 - Puntaje: 100% (AC) - (Theory Of Games).
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <bits/stdc++.h> | |
using namespace std; | |
typedef long long int lli; | |
int N; | |
lli sum = 0; | |
lli x,m,y,a,b; | |
int main(){ | |
ios_base::sync_with_stdio(0); | |
cin.tie(0); | |
int i; | |
cin>>N; | |
for(i=0; i<N; ++i){ | |
cin>>x>>m; | |
y = x+m; | |
a = x%4; | |
b = y%4; | |
sum ^= (a==3?x:(a==2?1:(a==1?(x-1):0))) ^ (b==3?y:(b==2?1:(b==1?(y-1):0))); | |
} | |
string ans = sum?"tolik":"bolik"; | |
cout<<ans<<"\n"; | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment