제출 #1302671

#제출 시각아이디문제언어결과실행 시간메모리
1302671sano버섯 세기 (IOI20_mushrooms)C++20
10 / 100
55 ms388 KiB
#include "mushrooms.h"
#define vec vector
#define For(i, n) for(int i = 0; i < n; i++)
using namespace std;

int count_mushrooms(int n) {
	vec<int> odp(n, 0);
	vec<int> m;
	m.push_back(0);
	for (int i = 1; i < n; i++) {
		vec<int> m2 = m;
		m.clear();
		m.push_back(m2.back());
		m.push_back(i);
		m2.clear();
		int c = use_machine(m);
		if(c == 1) odp[i] = 1 - odp[i-1];
		if(c == 0) odp[i] = odp[i-1];
	}
	int p1 = 0;
	For(i, n){
		if(odp[i]) continue;
		p1++;
	}
	return p1;
}
#Verdict Execution timeMemoryGrader output
Fetching results...