제출 #351878

#제출 시각아이디문제언어결과실행 시간메모리
351878tengiz05버섯 세기 (IOI20_mushrooms)C++17
10 / 100
312 ms512 KiB
#include "mushrooms.h"
#ifndef EVAL
#include "stub.cpp"
#endif
#include <bits/stdc++.h>
using namespace std;
int count_mushrooms(int n) {
	vector<int> a(n);
	a[0] = 0;
	for(int i=1;i<n;i++){
		vector<int> v = {i-1, i};
		int x = use_machine(v);
		if(x == 1)a[i] = a[i-1]^1;
		else a[i] = a[i-1];
	}int ans =0 ;
	for(int i=0;i<n;i++){
		ans += a[i]^1;
	}return ans;
}
#Verdict Execution timeMemoryGrader output
Fetching results...