Submission #1038165

#TimeUsernameProblemLanguageResultExecution timeMemory
1038165HanksburgerCoins (IOI17_coins)C++17
0 / 100
1 ms1124 KiB
#include "coins.h" #include <bits/stdc++.h> using namespace std; vector<int> coin_flips(vector<int> b, int c) { int s=0, t=0; for (int i=0; i<b.size(); i++) s+=b[i], t+=i*b[i]; for (int i=0; i<b.size(); i++) if (((1-(s+1-b[i]*2)%4/2*2)*(t+(1-b[i]*2)*i)+6400)%64==c) return vector<int>(1, i); } int find_coin(vector<int> b) { int s=0, t=0; for (int i=0; i<b.size(); i++) s+=b[i], t+=i*b[i]; return ((1-s%4/2*2)*t+6400)%64; }

Compilation message (stderr)

coins.cpp: In function 'std::vector<int> coin_flips(std::vector<int>, int)':
coins.cpp:7:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    7 |     for (int i=0; i<b.size(); i++)
      |                   ~^~~~~~~~~
coins.cpp:9:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    9 |     for (int i=0; i<b.size(); i++)
      |                   ~^~~~~~~~~
coins.cpp: In function 'int find_coin(std::vector<int>)':
coins.cpp:16:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   16 |     for (int i=0; i<b.size(); i++)
      |                   ~^~~~~~~~~
coins.cpp: In function 'std::vector<int> coin_flips(std::vector<int>, int)':
coins.cpp:12:1: warning: control reaches end of non-void function [-Wreturn-type]
   12 | }
      | ^
#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...