제출 #1201468

#제출 시각아이디문제언어결과실행 시간메모리
1201468tkm_algorithms버섯 세기 (IOI20_mushrooms)C++20
0 / 100
0 ms420 KiB
/**
*    In the name of Allah
*    We are nothing and you're everything
**/
#include <bits/stdc++.h>
#include "mushrooms.h"
using namespace std;
using ll = long long;

#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
//#define int long long

const char nl = '\n';

//int use_machine(vector<int> m) {
	//if (m[0] == 1 && m[1] != 1)return 1;
	//else if (m[0] != 1 && m[1] == 1)return 1;
	//return 0;
//}

int count_mushrooms(int n) {
	vector<int> m;
	int res = 0, onki = 1; // 1 type A
	//cout << onki << " ";
	for (int i = 1; i < n; ++i) {
		m = {i-1, i};
		int c = use_machine(m);
		if (c == 1) {
			onki = 1-onki;
			if (onki == 1)res += 1;
		} else{
			if (onki == 1)res += 1;
		}
		//cout << onki << " ";
	}
	
	if (onki == 1)res += 1;
	return res;
}

//int main() {
	//cout << count_mushrooms(4);
//}
#Verdict Execution timeMemoryGrader output
Fetching results...