Submission #301215

#TimeUsernameProblemLanguageResultExecution timeMemory
301215phillipCoins (IOI17_coins)C++14
10 / 100
11 ms1784 KiB
#include "coins.h" #include <bits/stdc++.h> #define ll long long using namespace std; vector<int> coin_flips(vector<int> b, int c) { vector<int> flips; for(int i=0;i<b.size();i++) { if(b[i]&&i!=c)flips.push_back(i); else if(b[i]==0&&i==c)flips.push_back(i); } if(flips.size()==0) { flips.push_back(0); flips.push_back(0); } // for(int i=0;i<flips.size();i++)cout<<flips[i]<<" "; return flips; for(int i=0,j=1;i<8;j*=2,i++) { if(c&(1<<i)) { if(b[i]==0){flips.push_back(i);}//b[i]=1-b[i];} } else { if(b[i]==1){flips.push_back(i);}//b[i]=1-b[i];} } } for(int i=0;i<8;i++) { // for(int j=0;j<8;j++)cout<<b[i*8+j];cout<<"\n"; } return flips; } int find_coin(vector<int> b) { int ret=0; for(int i=0,j=1;i<64;i++,j*=1) { if(b[i])return i; } //cout<<ret<<" "; return ret; }

Compilation message (stderr)

coins.cpp: In function 'std::vector<int> coin_flips(std::vector<int>, int)':
coins.cpp:8:18: 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++)
      |                 ~^~~~~~~~~
#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...