Submission #436232

#TimeUsernameProblemLanguageResultExecution timeMemory
436232BelguteiCounting Mushrooms (IOI20_mushrooms)C++17
45.66 / 100
20 ms328 KiB
#include "mushrooms.h" #include<bits/stdc++.h> using namespace std; #define ll long long #define ff first #define ss second #define pb push_back #define mk make_pair int ans=1; vector<int> v,v1; int count_mushrooms(int n) { v.pb(0); for(int i=1; i<n && i<397; i++){ vector<int> tur; tur.clear(); tur.pb(0); tur.pb(i); int val=use_machine(tur); if(val==0) v.pb(i),ans++; else v1.pb(i); } if(n<=397) return ans; if(v.size()>v1.size()){ int i=397; while(i<n){ vector<int> tur; tur.clear(); int pos=0; while(pos<v.size() && i<n){ tur.pb(v[pos]); tur.pb(i); i++; pos++; } int val=use_machine(tur); ans+=pos-(val+1)/2; } } else{ int i=397; while(i<n){ vector<int> tur; tur.clear(); int pos=0; while(pos<v1.size() && i<n){ tur.pb(v1[pos]); tur.pb(i); i++; pos++; } int val=use_machine(tur); ans+=(val+1)/2; } } return ans; //int c2 = use_machine(m); }

Compilation message (stderr)

mushrooms.cpp: In function 'int count_mushrooms(int)':
mushrooms.cpp:33:13: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   33 |    while(pos<v.size() && i<n){
      |          ~~~^~~~~~~~~
mushrooms.cpp:49:13: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   49 |    while(pos<v1.size() && i<n){
      |          ~~~^~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...