# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
303895 | temurbek_khujaev | Counting Mushrooms (IOI20_mushrooms) | C++17 | 12 ms | 384 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "mushrooms.h"
#include <bits/stdc++.h>
using namespace std;
int count_mushrooms(int n) {
vector<int> a = {0};
vector<int> b;
int pos = 1;
int cnta = a.size();
while (pos < n) {
vector<int> q;
if (a.size() > b.size()) {
int f = min(n - pos, (int) a.size());
for (int i = 0; i < f; i++) {
q.push_back(a[i]);
q.push_back(pos++);
}
int res = use_machine(q);
if (res & 1) {
b.push_back(q.back());
} else a.push_back(q.back());
cnta += f - (res + 1) / 2;
} else {
int f = min(n - pos, (int) b.size());
for (int i = 0; i < f; i++) {
q.push_back(b[i]);
q.push_back(pos++);
}
int res = use_machine(q);
if (res & 1) {
a.push_back(q.back());
} else b.push_back(q.back());
cnta += (res + 1) / 2;
}
}
return cnta;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |