제출 #860961

#제출 시각아이디문제언어결과실행 시간메모리
860961BlancaHMCoins (IOI17_coins)C++14
10 / 100
7 ms1364 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...