제출 #1297222

#제출 시각아이디문제언어결과실행 시간메모리
1297222kawhietCounting Mushrooms (IOI20_mushrooms)C++20
0 / 100
1 ms332 KiB
#include <bits/stdc++.h>
#include "mushrooms.h"
using namespace std;

int count_mushrooms(int n) {
	int res = 1, prv = 0;
	for (int i = 1; i < n; i++) {
		int x = use_machine({i - 1, i});
		if (prv == 0 && x == 0) {
			res++;
		} else if (prv == 1 && x == 1) {
			res++;
		}
		prv = x;
	}
	return res;
}
#Verdict Execution timeMemoryGrader output
Fetching results...