Submission #307384

# Submission time Handle Problem Language Result Execution time Memory
307384 2020-09-28T03:47:18 Z arthur_nascimento Counting Mushrooms (IOI20_mushrooms) C++14
Compilation error
0 ms 0 KB
#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;
}

Compilation message

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){
      |                     ^