제출 #1313704

#제출 시각아이디문제언어결과실행 시간메모리
1313704PlayVoltz버섯 세기 (IOI20_mushrooms)C++20
컴파일 에러
0 ms0 KiB
#include "mushrooms.h" #include <bits/stdc++.h> using namespace std; const int X=100; #define pb push_back #define mp make_pair #define pii pair<int, int> #define fi first #define se second int count_mushrooms(int n){ vector<int> ord; for (int i=1; i<n; ++i)ord.pb(i); vector<vector<int> > vect(2); vect[0].pb(0);// if (n<=227){ int res=1; for (int i=1; i<n; ++i)res+=!use_machine({0, i}); return res; } while (max(vect[0].size(), vect[1].size())<X){ if (use_machine({0, ord.back()}))vect[1].pb(ord.back()); else vect[0].pb(ord.back()); ord.pop_back(); } //while () int ans=vect[0].size(); while (p<n){ int id=0; if (vect[0].size()<vect[1].size())id=1; vector<int> temp; for (int i=0; i<vect[id].size()&&ord.size(); ++i)temp.pb(vect[id][i]), temp.pb(ord.back()), ord.pop_back(); int res=use_machine(temp); if (id)ans+=res/2+res%2; else ans+=temp.size()/2-(res/2+res%2); if (res%2)vect[!id].pb(p-1); else vect[id].pb(p-1); } return ans; }

컴파일 시 표준 에러 (stderr) 메시지

mushrooms.cpp: In function 'int count_mushrooms(int)':
mushrooms.cpp:33:16: error: 'p' was not declared in this scope
   33 |         while (p<n){
      |                ^