제출 #432523

#제출 시각아이디문제언어결과실행 시간메모리
432523Pbezz버섯 세기 (IOI20_mushrooms)C++14
25 / 100
151 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; if(n==2){ m={0,1}; int c1 = use_machine(m); if(c1==0)return 2; return 1; } if(n<=20000){ 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; } vector<int>b,a; m={0,1}; int c1 = use_machine(m); if(c1==0){//0 e 1 sao A ans=2; int go=0; 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){ a.pb(i); a.pb(i+1); ans+=2; } if(c1==1){ a.pb(i); b.pb(i+1); ans++; } if(c1==2){ b.pb(i); a.pb(i+1); ans++; } if(c1==3){ b.pb(i); b.pb(i+1); } if((int)a.size()>10){ go=1; break; } if((int)b.size()>10){ go=2; break; } } if(go==1){ } 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...