Submission #432987

#TimeUsernameProblemLanguageResultExecution timeMemory
432987lior5654Counting Mushrooms (IOI20_mushrooms)C++17
25 / 100
108 ms200 KiB
#include "mushrooms.h"
#include <bits/stdc++.h>

using namespace std;


typedef long long int ll;
typedef pair<ll, ll> pl;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<pl> vpl;
typedef vector<vpl> vvpl;
typedef pair<int, int> pi;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pi> vpi;
typedef vector<vpi> vvpi;

#define rep(i, n) for(int i = 0; i < n; ++i)
#define all(c) (c.begin()), (c.end())
#define pb push_back
#define eb emplace_back
#define fi first
#define se second

int n; int res = 0;
int count_mushrooms(int N) {
	n=N;
	res = 1;
	int next = 1;
	while(next + 1 < n) {
		res += 2 - use_machine({next, 0, next+1}); next += 2;
	}
	if(next < n) {
		res += !use_machine({0, next});
	}
	return res;
}
#Verdict Execution timeMemoryGrader output
Fetching results...