Submission #859316

#TimeUsernameProblemLanguageResultExecution timeMemory
859316nguyentunglamCoins (IOI17_coins)C++17
100 / 100
7 ms1948 KiB
#include "coins.h" #include<bits/stdc++.h> using namespace std; std::vector<int> coin_flips(std::vector<int> b, int c) { int Xor = 0; for(int i = 0; i < b.size(); i++) if (b[i]) Xor ^= i; int change = Xor ^ c; return {change}; } int find_coin(std::vector<int> b) { int ret = 0; for(int i = 0; i < b.size(); i++) if (b[i]) ret ^= i; return ret; }

Compilation message (stderr)

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