Skip to content

Instantly share code, notes, and snippets.

@IvanIsCoding
Created August 24, 2018 21:23
Show Gist options
  • Select an option

  • Save IvanIsCoding/f4045192efcd00d49024cfed6bee5803 to your computer and use it in GitHub Desktop.

Select an option

Save IvanIsCoding/f4045192efcd00d49024cfed6bee5803 to your computer and use it in GitHub Desktop.
Practice Session of IOI 2017
// Ivan Carvalho
// Coins - IOI 2017 Practice
// 1 coin flip
#include "coins.h"
#include <bits/stdc++.h>
using namespace std;
vector<int> coin_flips(vector<int> b, int c) {
int meu_inteiro = 0;
for(int i = 0;i<64;i++) if(b[i]) meu_inteiro ^= i;
vector<int> ans;
ans.push_back(c ^ meu_inteiro);
return ans;
}
int find_coin(vector<int> b) {
int meu_inteiro = 0;
for(int i = 0;i<64;i++) if(b[i]) meu_inteiro ^= i;
return meu_inteiro;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment