# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
312850 | DanerZein | 버섯 세기 (IOI20_mushrooms) | C++14 | 1 ms | 384 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "mushrooms.h"
#include <bits/stdc++.h>
using namespace std;
typedef vector<int> vi;
int punt[4];
int count_mushrooms(int n) {
int res=1;
int ca,cb;
vi pa,pb;
pa.push_back(0);
ca=cb=0;
for(int i=1;i<=min(2,n-1);i++){
vector<int> aux;
aux.push_back(0);
aux.push_back(i);
//cout<<use_machine(aux)<<" "<<i<<endl;
if(use_machine(aux)){
cb++;
pb.push_back(i);
}
else{
ca++;
res++;
pa.push_back(i);
}
}
ca++;
memset(punt,0,sizeof punt);
bool sw=0;
if(ca>=cb){
int p=3;
punt[0]=3;
int j=1;
while(true){
p--;
punt[j]=punt[j+1]=p;
j+=2;
if(p==0) break;
}
sw=1;
}
else{
int p=0;
punt[0]=0;
int j=1;
while(true){
p++;
punt[j]=punt[j+1]=p;
j+=2;
if(p==3) break;
}
}
int c=max(ca,cb);
//cout<<ca<<" "<<cb<<endl;
for(int i=3;i<n;i+=c){
//cout<<i<<endl;
vector<int> aux;
for(int j=0;j<c;j++){
if(i+j<n) aux.push_back(i+j);
if(sw==1)
aux.push_back(pb[j]);
else
aux.push_back(pa[j]);
}
res+=(punt[use_machine(aux)]);
}
return res;
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |