Submission #305938

#TimeUsernameProblemLanguageResultExecution timeMemory
305938Jarif_RahmanCounting Mushrooms (IOI20_mushrooms)C++17
10 / 100
267 ms512 KiB
#include "mushrooms.h"
#include <bits/stdc++.h>
#define pb push_back
#define f first
#define sc second
#define um use_machine
using namespace std;
typedef long long int ll;
typedef string str;
int n;
int count_mushrooms(int nn){
    n = nn;
    int ans = 1;
    bool cur = 1;
    for(int i = 1; i < n; i++){
        if(um({i-1, i}) > 0) cur = !cur;
        if(cur) ans++;
    }
    return ans;
}
#Verdict Execution timeMemoryGrader output
Fetching results...