| # | Time | Username | Problem | Language | Result | Execution time | Memory | 
|---|---|---|---|---|---|---|---|
| 1080072 | Sir_Ahmed_Imran | Counting Mushrooms (IOI20_mushrooms) | C++17 | 82 ms | 1092 KiB | 
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
                            ///~~~LOTA~~~///
#include "mushrooms.h"
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define append push_back
#define add insert
#define nl '\n'
#define ff first
#define ss second
#define pii pair<int,int>
#define pll pair<ll,ll>
#define all(x) (x).begin(),(x).end()
#define L0TA ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define terminator main
#define N 1501
int count_mushrooms(int n){
    int m;
    vector<int> a,b;
    a.append(0);
    if(use_machine({0,1}))
        b.append(1);
    else a.append(1);
    if(n>2){
        if(use_machine({0,2}))
            b.append(2);
        else a.append(2);
    }
    if(b.size()==2) swap(a,b);
    for(int i=3;i<n-1;i+=2){
        m=use_machine({i,a[0],i+1,a[1]});
        if(m%2) b.append(i);
        else a.append(i);
        if(m>1) b.append(i+1);
        else a.append(i+1);
    }
    if(n%2==0 && n>2){
        if(use_machine({a[0],n-1}))
            b.append(n-1);
        else a.append(n-1);
    }
    if(!a[0]) return a.size();
    return b.size();
}
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
