Submission #1078971

#TimeUsernameProblemLanguageResultExecution timeMemory
1078971Trumling버섯 세기 (IOI20_mushrooms)C++14
45.38 / 100
8 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,402);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()==401 || B.size()==401) break; } ll counta=A.size()/2 + 1; i++; for(i=i;i<n;i+=200) { if(A.size()==401) { if(i+200<=n) { for(int j=0;j<200;j++) A[j*2+1]=i+j; ll ans=use_machine(A); counta+=200-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+200<=n) { for(int j=0;j<200;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...