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"
using namespace std;
vector<int> coin_flips(vector<int> b, int c) {
vector<int> flips;
// Es obligatorio girar al menos una casilla => giremos b[c]
flips.push_back(c);
b[c] = 1 - b[c];
// Giramos el resto para que no coincidan
for (int i = 0; i <= 63; i++) {
if (b[i] == b[c] && i != c) {
flips.push_back(i);
}
}
return flips;
}
int find_coin(vector<int> b) {
// Comprobamos si lo que se repiten son 1s o 0s
int ones_count = 0;
for (int i = 0; i <= 63; i++) {
ones_count += b[i];
}
int searched = 1 - ones_count/63;
// Buscamos entonces la moneda distinta
for (int i = 0; i <= 62; i++) {
if (b[i] == searched) return i;
}
return 63;
}
# | 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... |