Submission #1078940

#TimeUsernameProblemLanguageResultExecution timeMemory
1078940TrumlingCounting Mushrooms (IOI20_mushrooms)C++14
0 / 100
5 ms600 KiB
#include "mushrooms.h" #include <bits/stdc++.h> using namespace std; typedef long long ll; #define pb push_back #define F first #define S second #define enter cout<<'\n'; #define INF 99999999999999999 #define MOD 1000000007 #define all(x) x.begin(),x.end() int count_mushrooms(int n) { vector<int>A,B; A.pb(0); int i; for(i=1;i<min(n,200);i++) { ll ans=use_machine({0,i}); if(ans) { if(B.size()!=0) B.pb(-1); B.pb(i); } else { A.pb(-1); A.pb(i); } if(A.size()==201 || B.size()==201) break; } ll counta=A.size()/2 + 1; i++; for(i=i;i<n;i+=100) { if(B.size()<=A.size()) { if(i+100<n) { for(int j=0;j<100;j++) A[j*2+1]=i+j; ll ans=use_machine(A); counta+=100-ans/2; continue; } vector<int>p; int j; for(j=0;j<n-i;j++) { p.pb(A[j*2]); p.pb(i+j); } p.pb(A[j*2]); ll ans=use_machine(p); counta+=(n-i)-ans/2; } else { if(i+100<n) { for(int j=0;j<100;j++) B[j*2+1]=i+j; ll ans=use_machine(B); counta+=ans/2; continue; } vector<int>p; int j; for(j=0;j<n-i;j++) { p.pb(B[j*2]); p.pb(i+j); } p.pb(B[j*2]); ll ans=use_machine(p); counta+=ans/2; } } return counta; }
#Verdict Execution timeMemoryGrader output
Fetching results...