# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1059125 | Huseyn123 | Counting Mushrooms (IOI20_mushrooms) | C++17 | 5 ms | 608 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.
#include "mushrooms.h"
#include <bits/stdc++.h>
#define pb push_back
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int count_mushrooms(int n) {
vector<int> c;
for(int i=1;i<n;i++){
c.push_back(i);
}
shuffle(c.begin(),c.end(),rng);
vector<int> v0,v1;
v0.push_back(0);
int cnt=0;
int cnt1=0;
int i=0;
while(i<n-1){
if((v0.size()<2 && v1.size()<2) || i==n-2){
int h=use_machine({c[i],0});
if(h==0){
v0.push_back(c[i]);
}
else{
v1.push_back(c[i]);
}
cnt=i+1;
i++;
cnt1++;
}
else{
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |