제출 #1240389

#제출 시각아이디문제언어결과실행 시간메모리
1240389MuhammadSaramCounting Mushrooms (IOI20_mushrooms)C++20
0 / 100
0 ms420 KiB
#include "mushrooms.h" #include <bits/stdc++.h> using namespace std; #define get use_machine int count_mushrooms(int n) { vector<int> v={0},v1; int ans=1; for (int i=1;i<n;) { bool b=0; if (v.size()<v1.size()) swap(v,v1), b=1; int m=v.size(); vector<int> c; int tot=0; for (int id=0;i<n && id<m;i++,id++) c.push_back(v[id]), c.push_back(i), tot++; int x=get(c); if (b) { ans+=(x+1)/2; if (x%2) v.push_back(c.back()); else v1.push_back(c.back()); } else { ans+=tot-(x+1)/2; if (x%2) v1.push_back(c.back()); else v.push_back(c.back()); } if (b) swap(v,v1); } return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...