# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1006172 | Abdullah_Alodaibi | Coins (IOI17_coins) | C++17 | 0 ms | 0 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
vector<int> coin_flips(vector<int> b, int c){
int x=0;
for(int i=0;i<b.size();i++){
x^=b[i]*i;
x%=b.size();
}
b[x^c]=(b[x^c]+1)%2;
return b;
}
int find_coin(vector<int> b){
int x=0;
for(int i=0;i<b.size();i++){
x^=b[i]*i;
x%=b.size();
}
return x;
}
int main(){
ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
ll t;
cin>>t;
while(t--){
vector<int> b;
int c;
cin>>c;
for(int i=0;i<64;i++){
char x;
cin>>x;
b.push_back(int(x)-48);
}
cout<<find_coin(coin_flips(b,c))<<"\n";
}
}