# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
648079 | ojoConmigo | Coins (IOI17_coins) | C++17 | 11 ms | 1552 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 "coins.h"
//#include <bits/stdc++.h>
//using namespace std;
std::vector<int> coin_flips(std::vector<int> b, int c) {
/* Subtask 1 y 2
std::vector<int> flips(1);
flips[0] = 63;
if(b[0] == b[1] && b[1] == b[2]){
flips[0] = c;
}else{
for(int i=0; i<3; i++){
if(c == i)continue;
if(b[i] == b[c]){
flips[0] = i;
}
}
}
*/
/*Subtast 3 y 4
std::vector<int> flips;
for(int i=0; i<6; i++){
if(((c&(1<<i)) > 0) != b[i]){
//cout << (c&(1<<i)) << " " << b[i] << endl;
//cout << c << " " << (1<<i) << " " << b[i] << endl;
flips.push_back(i);
}
}
if(flips.empty()){
flips.push_back(63);
}
*/
std::vector<int> flips(1);
int temp = 0;
for(int i=0; i<64; i++){
if(b[i]){
temp ^= i;
}
}
flips[0] = temp^c;
return flips;
}
int find_coin(std::vector<int> b) {
/* Subtask 1 y 2
if (b[0] == b[1]) {
return 2;
}else if(b[0] == b[2]){
return 1;
}else return 0;
*/
/*Subtast 3 y 4
int sol = 0;
for(int i=0; i<6; i++){
if(b[i]){
sol |= (1<<i);
//cout << i << " " << (1<<i) << " " << sol << endl;
}
}
*/
int sol = 0;
for(int i=0; i<64; i++){
if(b[i]){
sol ^= i;
}
}
return sol;
}
/*
int main(){
int t;
cin >> t;
while(t--){
int c;
cin >> c;
vector<int> b(64);
for(int i=0; i<64; i++){
cin >> b[i];
}
vector<int> flips = coin_flips(b,c);
for(int x : flips){
b[x] = 1 - b[x];
}
/*
for(int i=0; i<8; i++){
for(int j=0; j<8; j++){
cout << b[i*8+j];
}
cout << endl;
}
cout << find_coin(b) << endl;
}
}
*/
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |