# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
432486 | Pbezz | Counting Mushrooms (IOI20_mushrooms) | C++14 | 149 ms | 316 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>
using namespace std;
#define ll long long
#define pb push_back
typedef pair<ll,ll> pii;
const ll MAXN = 2e5+5;
const ll INF = 1e9+7;
int count_mushrooms(int n) {
std::vector<int> m; int ans=1,i;
if(n==2){
m={0,1};
int c1 = use_machine(m);
if(c1==0)return 2;
return 1;
}
m={0,1};
int c1 = use_machine(m);
if(c1==0){//0 e 1 sao A
ans=2;
for(i=2;i<n-1;i+=2){//testar i e i+2
m={0,i,1,i+1};
int c1 = use_machine(m);
if(c1==0)ans+=2;
if(c1==1)ans++;
if(c1==2)ans++;
}
if(n%2==1){
m={0,n-1};
int c1 = use_machine(m);
if(c1==0)ans++;
}
}else{
m={1,2};
int c1 = use_machine(m);
if(c1==0){//1 e 2 sao B
ans=1;
for(i=3;i<n-1;i+=2){//testar i e i+2
m={1,i,2,i+1};
int c1 = use_machine(m);
if(c1==1)ans++;
if(c1==2)ans++;
if(c1==3)ans+=2;
}
if(n%2==0){
m={0,n-1};
int c1 = use_machine(m);
if(c1==0)ans++;
}
}else{//0 e 2 sao A
ans=2;
for(i=3;i<n-1;i+=2){//testar i e i+2
m={0,i,2,i+1};
int c1 = use_machine(m);
if(c1==0)ans+=2;
if(c1==1)ans++;
if(c1==2)ans++;
}
if(n%2==0){
m={0,n-1};
int c1 = use_machine(m);
if(c1==0)ans++;
}
}
}
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |