(UPD: 2024-12-04 14:48 UTC) Judge is not working due to Cloudflare incident. (URL) We can do nothing about it, sorry. After the incident is resolved, we will grade all submissions.

Submission #385813

#TimeUsernameProblemLanguageResultExecution timeMemory
385813The_BitchCoins (IOI17_coins)C++14
10 / 100
13 ms1792 KiB
#include<bits/stdc++.h> #include "coins.h" #define F first #define S second #define pb push_back using namespace std; std::vector<int> coin_flips(std::vector<int> b, int c) { int flag=0; vector<int>flibs; for(int i=0;i<64;i++){ if(b[i]==1&&i!=c) flag=1; } if(flag==1){ for(int i=0;i<64;i++){ if(i!=c&&b[i]!=0){ flibs.pb(i); } else if(i==c&&b[i]!=1) flibs.pb(i); } } else{ for(int i=0;i<64;i++){ if(i!=c&&b[i]!=1){ flibs.pb(i); } else if(i==c&&b[i]!=0) flibs.pb(i); } } return flibs; } int find_coin(std::vector<int> b) { map<int,int>mp; int index; for(int i=0;i<64;i++){ mp[b[i]]++; } for(int i=0;i<64;i++) if(mp[b[i]]==1) index=i; return index; } 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) { return "wrong coin"; } return "ok"; } /*int main() { int tests; cin >> tests; for (int t = 1; t <= tests; t++) { string result = run_test(); cout << "test #" << t << ": " << result << endl; } return 0; }*/

Compilation message (stderr)

coins.cpp:45:15: warning: 'std::string run_test()' defined but not used [-Wunused-function]
   45 | static string run_test() {
      |               ^~~~~~~~
coins.cpp: In function 'int find_coin(std::vector<int>)':
coins.cpp:43:12: warning: 'index' may be used uninitialized in this function [-Wmaybe-uninitialized]
   43 |     return index;
      |            ^~~~~
#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...