Submission #432483

#TimeUsernameProblemLanguageResultExecution timeMemory
432483PbezzCounting Mushrooms (IOI20_mushrooms)C++14
0 / 100
128 ms256 KiB
#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; 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 timeMemoryGrader output
Fetching results...