Skip to content

Instantly share code, notes, and snippets.

@mikebsg01
Last active March 12, 2017 21:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mikebsg01/fc554ae373988bef5aad to your computer and use it in GitHub Desktop.
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).
#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