/**
* 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 time | Memory | Grader output |
---|
Fetching results... |