# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1132874 | StefanSebez | Counting Mushrooms (IOI20_mushrooms) | C++20 | 54 ms | 424 KiB |
#include <bits/stdc++.h>
#include "mushrooms.h"
using namespace std;
#define fi first
#define se second
#define pb push_back
#define ll long long
#define ld long double
mt19937 rng(time(0));
int K=3;
int count_mushrooms(int n){
int res=1;
int a[n+10]={0};
for(int i=1;i<min(K,n);i++){
vector<int>temp={0,i};
if(use_machine(temp)==1) a[i]=1;
else res++;
}
int num[2]={0};
for(int i=0;i<min(K,n);i++){
num[a[i]]++;
//printf("%i ",a[i]);
}
//printf("\n");
//printf("%i %i\n",num[0],num[1]);
if(num[0]>=num[1]){
vector<int>ind;
for(int i=0;i<min(K,n);i++) if(a[i]==0) ind.pb(i);
//for(auto i:ind) printf("%i ",i);printf("\n");
int k=ind.size();
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |