# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
424318 | Apiram | Counting Mushrooms (IOI20_mushrooms) | C++14 | 0 ms | 200 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "mushrooms.h"
#include<bits/stdc++.h>
using namespace std;
int count_mushrooms(int n) {
vector<int>a,b;
a.push_back(0);
int ans=0;
vector<int>both;
for (int i =1;i<n;++i){
both.push_back(i);
if (both.size()!=max(a.size(),b.size()))continue;
if (a.size()>b.size()){
vector<int>cur;
for (int i =0;i<both.size();++i){
cur.push_back(both[i]);
cur.push_back(a[i]);
}
int k = use_machine(cur);
ans+=both.size() - (k + 1)/2 ;
if (k%2==1){
a.push_back(cur[0]);
}
else b.push_back(cur[0]);
}
else {
vector<int>cur;
for (int i =0;i<both.size();++i){
cur.push_back(both[i]);
cur.push_back(b[i]);
}
int k = use_machine(cur);
ans+=(k + 1)/2 ;
if (k%2==1){
b.push_back(cur[0]);
}
else a.push_back(cur[0]);
}
both.clear();
}
if (!both.empty()){
if (a.size()>b.size()){
vector<int>cur;
for (int i =0;i<both.size();++i){
cur.push_back(both[i]);
cur.push_back(a[i]);
}
int k = use_machine(cur);
ans+=both.size() - (k + 1)/2 ;
if (k%2==1){
a.push_back(cur[0]);
}
else b.push_back(cur[0]);
}
else {
vector<int>cur;
for (int i =0;i<both.size();++i){
cur.push_back(both[i]);
cur.push_back(b[i]);
}
int k = use_machine(cur);
ans+=(k + 1)/2 ;
if (k%2==1){
b.push_back(cur[0]);
}
else a.push_back(cur[0]);
}
}
return ans + a.size();
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |