# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
346659 | SecretK | Counting Mushrooms (IOI20_mushrooms) | C++14 | 195 ms | 512 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "mushrooms.h"
#include<bits/stdc++.h>
/*
16
0 0 1 1 1 0 1 0 1 0 1 0 0 0 0 0
*/
int count_mushrooms(int n){
std::vector<int> m;
bool a = 0;
int ans = 1,i,t,j;
for(i = 0;i < n-3;i+=3){
t = use_machine({i,i+1,i+2,i+3});
if(t == 0 && !a) ans += 3;
if(t == 3) {if(!a) {ans++; a = 1;}
else {ans += 2; a = 0;}}
if(t == 1){
if(!a){
a = 1;
if(!use_machine({i,i+1,i+2})) ans += 2;
else if(!use_machine({i,i+1})) ans++;
}
else{
a = 0;
if(!use_machine({i,i+1,i+2})) ans++;
else{ if(!use_machine({i,i+1})) ans += 2;
else ans += 3;}
}
}
if(t == 2){
if(!a){
if(use_machine({i+1,i+2})) ans+=2;
else ans++;
}
else{
if(use_machine({i+1,i+2})) ans++;
else ans+=2;
}
}
//printf("ans = %d i = %d\n",ans,i);
}
if(i == n-3){
j = use_machine({i,i+1,i+2});
if(j == 2) ans++;
if(j == 0) if(!a) ans+=2;
if(j == 1){
if(use_machine({i,i+1})){ if(a) ans+=2;}
else ans++;
}
}
if(i == n-2){
if(a){
if(use_machine({i,i+1})) ans++;
}
else{
if(!use_machine({i,i+1})) ans++;
}
}
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |