Submission #1064842

#TimeUsernameProblemLanguageResultExecution timeMemory
1064842XJP12Counting Mushrooms (IOI20_mushrooms)C++14
10 / 100
129 ms356 KiB
#include <bits/stdc++.h>
#include "mushrooms.h"
using namespace std;
typedef vector<int> vi;
int count_mushrooms(int n) {
	vi m;
	int c1=1;
    bool ban=true;
    for(int i=0; i<n-1; i++){
        m.clear();
        m.push_back(i);
        m.push_back(i+1);
        int x =use_machine(m);
        if(ban){
            if(x==1){ban=false;}else{c1++;}   
        }else{
            if(x==1){ban=true; c1++;}
        }
    }
	return c1;
}
#Verdict Execution timeMemoryGrader output
Fetching results...