Submission #333884

#TimeUsernameProblemLanguageResultExecution timeMemory
333884inwbearCounting Mushrooms (IOI20_mushrooms)C++14
0 / 100
3 ms492 KiB
#include "mushrooms.h" #include<bits/stdc++.h> using namespace std; #define pb push_back #define all(x) (x).begin(),(x).end() #define MEM(x,a) memset((x),a,sizeof((x))) #define F first #define S second #define imx INT_MAX #define X 202 const long long MOD = (long long)(1e9+7); const long long MMX = (long long)(1e18); typedef long long LL; typedef pair<int,int> pii; int count_mushrooms(int n) { int k,rr=1,ca=0; vector<int>a,b,t; a.pb(0); for(int i=1;i<n&&i<=X;i++) { t.clear(); t.pb(0); t.pb(i); k=use_machine(t); if(k==1)b.pb(i); else a.pb(i); } for(int i=X+1;i<n;i++,rr++) { if(rr==1)t.clear(),t.pb(b[0]); t.pb(i); t.pb(b[rr]); if(i==n-1||rr+1==b.size()) { k=use_machine(t); rr=0; ca+=k/2; } } return a.size()+ca; }

Compilation message (stderr)

mushrooms.cpp: In function 'int count_mushrooms(int)':
mushrooms.cpp:35:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   35 |   if(i==n-1||rr+1==b.size())
      |              ~~~~^~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...