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