Submission #884483

#TimeUsernameProblemLanguageResultExecution timeMemory
884483weajinkCounting Mushrooms (IOI20_mushrooms)C++17
0 / 100
0 ms344 KiB
#include "mushrooms.h" #include <bits/stdc++.h> using namespace std; typedef long long ll; #ifdef LOCAL #define debug(...) __VA_ARGS__ #else #define debug(...) {} #endif int count_mushrooms(int n){ vector<int> znane[2]; znane[0].push_back(0); int ile[2] = {0}; int akt = 1; while (akt < n){ bool better = (znane[0].size()<znane[1].size()); int pt = 0; vector<int> zap; for (; akt < n && pt < znane[better].size(); akt++,pt++){ zap.push_back(znane[better][pt]); zap.push_back(akt); } int wy = use_machine(zap); if (wy%2) znane[!better].push_back(akt-1); else znane[better].push_back(akt-1); ile[better] += pt-(wy+1)/2; ile[!better] += (wy+1)/2; } return ile[0]; }

Compilation message (stderr)

mushrooms.cpp: In function 'int count_mushrooms(int)':
mushrooms.cpp:20:30: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   20 |         for (; akt < n && pt < znane[better].size(); akt++,pt++){
      |                           ~~~^~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...