Submission #388035

#TimeUsernameProblemLanguageResultExecution timeMemory
388035SupersonicCounting Mushrooms (IOI20_mushrooms)C++14
0 / 100
8 ms328 KiB
#include "mushrooms.h" #include <bits/stdc++.h> using namespace std; int count_mushrooms(int n) { int k=20001; vector<int> a;vector<int> b;a.push_back(0); int r1=use_machine({0,1});if(r1)b.push_back(1);else a.push_back(1); int r2=use_machine({0,2});if(r2)b.push_back(2);else a.push_back(2); int c=3; if(a.size()==2){ while(c<n-1&&max(a.size(),b.size())<k){ r1=use_machine({a[0],c,a[1],c+1}); if(r1==0){a.push_back(c);a.push_back(c+1);} if(r1==1){a.push_back(c);b.push_back(c+1);} if(r1==2){b.push_back(c);a.push_back(c+1);} if(r1==3){b.push_back(c);b.push_back(c+1);} c+=2; } } else{ while(c<n-1&&max(a.size(),b.size())<k){ r1=use_machine({b[0],c,b[1],c+1}); if(r1==0){b.push_back(c);b.push_back(c+1);} if(r1==1){b.push_back(c);a.push_back(c+1);} if(r1==2){a.push_back(c);b.push_back(c+1);} if(r1==3){a.push_back(c);a.push_back(c+1);} c+=2; } } if(c==n-1){ if(use_machine({0,n-1})==1)b.push_back(n-1); else a.push_back(n-1); c++; } if(c==n)return a.size(); return 0; }

Compilation message (stderr)

mushrooms.cpp: In function 'int count_mushrooms(int)':
mushrooms.cpp:11:38: warning: comparison of integer expressions of different signedness: 'const long unsigned int' and 'int' [-Wsign-compare]
   11 |   while(c<n-1&&max(a.size(),b.size())<k){
      |                ~~~~~~~~~~~~~~~~~~~~~~^~
mushrooms.cpp:21:38: warning: comparison of integer expressions of different signedness: 'const long unsigned int' and 'int' [-Wsign-compare]
   21 |   while(c<n-1&&max(a.size(),b.size())<k){
      |                ~~~~~~~~~~~~~~~~~~~~~~^~
#Verdict Execution timeMemoryGrader output
Fetching results...