제출 #1238116

#제출 시각아이디문제언어결과실행 시간메모리
1238116ayathkCoins (IOI17_coins)C++20
0 / 100
5 ms584 KiB
#include <bits/stdc++.h> #include "coins.h" using namespace std; #define fi first #define se second #define all(a) a.begin(),a.end() #define pb push_back const int maxn = 2e5+1; vector <int> coin_flips(vector <int> b, int c){ vector <int> d; int o = 0 ,z = 0; for(int i : b){ if(i == 1)o++; else z++; } int ch = -1; if(o > z)ch = 1; else ch = 0; if(o == 3 || z == 3){ d.push_back(c); return d; } if(b[c] == ch){ for(int i = 0;i < b.size();i++){ if(b[i] == ch && i != c){ d.push_back(i); break; } } } else{ d.push_back(3); } return d; } int find_coin(vector <int> b){ int o = 0 ,z = 0; for(int i = 0;i < 3;i++){ if(b[i] == 1)o++; else z++; } int ch = -1; if(o > z)ch = 1; else ch = 0; for(int i = 0;i < b.size();i++){ if(b[i] != ch)return i; } return 0; } // static string run_test() { // int c; // cin >> c; // vector<int> b(64); // for (int i = 0; i < 8; i++) { // string s; // cin >> s; // for (int j = 0; j < 8; j++) { // b[i * 8 + j] = int(s[j] - '0'); // } // } // vector<int> flips = coin_flips(b, c); // if ((int)flips.size() == 0) { // return "0 turn overs"; // } // for (int i = 0; i < (int)flips.size(); i++) { // if (flips[i] < 0 || flips[i] > 63) { // return "cell number out of range"; // } // b[flips[i]] = 1 - b[flips[i]]; // } // int coin = find_coin(b); // if (coin != c) { // cout<<coin<<' '; // return "wrong coin"; // } // return "ok"; // } // signed main() { // int tests; // cin >> tests; // for (int t = 1; t <= tests; t++) { // string result = run_test(); // cout << "test #" << t << ": " << result << endl; // } // return 0; // }
#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...