| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 305914 | myungwoo | 버섯 세기 (IOI20_mushrooms) | C++17 | 127 ms | 632 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#include "mushrooms.h"
using namespace std;
int count_mushrooms(int N)
{
vector<int> arr[2] = {{0}, {}};
int pt = 1;
// Step 1: Check type of mushroom one by one
while (pt < N){
arr[use_machine({0, pt})].push_back(pt);
pt++;
if (arr[0].size() >= 2 || arr[1].size() >= 2) break;
}
// Step 2: Check type of mushroom two by one
while (pt < N){
int t = arr[1].size() >= 2;
vector<int> test = {arr[t][0], pt, arr[t][1]};
if (pt+1 < N) test.push_back(pt+1);
int res = use_machine(test);
arr[res>>1&1^t].push_back(pt);
if (pt+1 < N) arr[res&1^t].push_back(pt+1);
pt += 2;
}
return arr[0].size();
}
컴파일 시 표준 에러 (stderr) 메시지
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
