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