제출 #1219131

#제출 시각아이디문제언어결과실행 시간메모리
1219131giorgi123glmCoins (IOI17_coins)C++20
0 / 100
1 ms584 KiB
#include "coins.h" #include <cstdlib> #include <iostream> #include <vector> using namespace std; vector<int> coin_flips(vector<int> b, int c) { int dplus = 0; int dminu = 0; int hash = 0; for (int& e : b) if (e == 0) dplus++; else dminu++, hash++; hash %= 64; if (c == hash) // nice return b; else { int ansplus = hash - c; if (ansplus < 0) ansplus += 64; if (ansplus < dplus) { vector <int> ans; for (int i = 0; i <= 63; i++) if (b[i] == 0 && ansplus) { ans.emplace_back (i); ansplus--; } return ans; } int ansminu = c - hash; if (ansminu < 0) ansminu += 64; if (ansminu < dminu) { vector <int> ans; for (int i = 0; i <= 63; i++) if (b[i] == 1 && ansminu) { ans.emplace_back (i); ansminu--; } return ans; } // ? exit (1); } } int find_coin(vector<int> b) { int hash = 0; for (int& e : b) if (e == 1) hash++; return (hash + 64) % 64; }
#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...