(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 #829898

#TimeUsernameProblemLanguageResultExecution timeMemory
829898somethingnewCoins (IOI17_coins)C++17
100 / 100
8 ms1564 KiB
#include <iostream> #include "algorithm" #include "array" #include "bitset" #include "climits" #include "cmath" #include "deque" #include "iomanip" #include "map" #include "numeric" #include "set" #include "vector" #define all(x) x.begin(), x.end() #define sz(x) (int)x.size() using namespace std; #include "coins.h" vector<int> coin_flips(vector<int> b, int c) { // cout << "INP" << c << endl; for (int i = 0; i < b.size(); i++) { if (b[i]) c ^= i; } return {c}; } int find_coin(std::vector<int> b) { int c = 0; for (int i = 0; i < b.size(); i++) { if (b[i]) c ^= i; } //cout << c << endl; return c; } #ifdef LOCAL 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() { freopen("inp.txt", "r", stdin); int tests; cin >> tests; for (int t = 1; t <= tests; t++) { string result = run_test(); cout << "test #" << t << ": " << result << endl; } return 0; } #endif

Compilation message (stderr)

coins.cpp: In function 'std::vector<int> coin_flips(std::vector<int>, int)':
coins.cpp:21:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   21 |     for (int i = 0; i < b.size(); i++) {
      |                     ~~^~~~~~~~~~
coins.cpp: In function 'int find_coin(std::vector<int>)':
coins.cpp:29:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   29 |     for (int i = 0; i < b.size(); i++) {
      |                     ~~^~~~~~~~~~
#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...