Submission #1240122

#TimeUsernameProblemLanguageResultExecution timeMemory
1240122franuchCounting Mushrooms (IOI20_mushrooms)C++20
10 / 100
49 ms420 KiB
#include "mushrooms.h"
#include <bits/stdc++.h>
using namespace std;
typedef int ll;
typedef pair<ll, ll> pll;
#define vc vector
#define st first
#define nd second
#define all(a) a.begin(), a.end()
#define sz(a) (ll)a.size()
#define pub push_back
#define pob pop_back

ll count_mushrooms(ll n) {
	vc<ll> a(n, -1);
	a[0] = 0;
	for (ll i = 1; i < n; i++)
		if (use_machine({i - 1, i}) == 0)
			a[i] = a[i - 1];
		else
			a[i] = a[i - 1]  ^ 1;
	ll ret = 0;
	for (ll &ai : a)
		if (ai == 0)
			ret++;
	return ret;
}
#Verdict Execution timeMemoryGrader output
Fetching results...