제출 #307384

#제출 시각아이디문제언어결과실행 시간메모리
307384arthur_nascimento버섯 세기 (IOI20_mushrooms)C++14
컴파일 에러
0 ms0 KiB
#include "mushrooms.h" #define pb push_back using namespace std; const int C = 100; int count_mushrooms(int n) { vector<int> A,B; A.pb(0); for(int i=1;i<min(C,n);i++){ vector<int> v; v.pb(0); v.pb(i); int x = use_machine(v); if(x) B.pb(i); else A.pb(i); } int ans = A.size(); int eff = 0; for(int i=C;i<n;i+=t-1){ int t = max(A.size(), B.size()); int use = 0; if(B.size() > A.size()) use = 1; vector<int> vec = A; if(use) vec = B; vector<int> v; eff = 0; for(int j=0;j<t;j++){ v.pb(vec[j]); if(j < t-1 && i+j < n) v.pb(i+j), eff++; } int x = use_machine(v); //printf("ff %d\n",eff); if(use) ans += x/2; else ans += eff - (x/2); } return ans; }

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

mushrooms.cpp: In function 'int count_mushrooms(int)':
mushrooms.cpp:24:21: error: 't' was not declared in this scope
   24 |  for(int i=C;i<n;i+=t-1){
      |                     ^