# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1052188 | mychecksedad | 버섯 세기 (IOI20_mushrooms) | C++17 | 5 ms | 856 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "mushrooms.h"
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define all(x) x.begin(),x.end()
#define vi vector<int>
#define pii pair<int,int>
#define ff first
#define ss second
int count_mushrooms(int n) {
vector<int> A, B;
A.pb(0);
int last = 1, add = 0;
while(last < n){
if(A.size() > B.size()){
vector<int> q;
int s = A.size();
for(int j = last; j < min(n, last + s); ++j){
q.pb(j);
q.pb(A[j - last]);
}
last = min(n, last + s);
int f = use_machine(q);
s = q.size()/2 - 1;
add += s - f/2;
if(f%2==0) A.pb(q[0]);
else B.pb(q[0]);
}else{
vector<int> q;
int s = B.size();
for(int j = last; j < min(n, last + s); ++j){
q.pb(j);
q.pb(B[j - last]);
}
int f = use_machine(q);
add += f/2;
if(f%2==1) A.pb(q[0]);
else B.pb(q[0]);
last = min(n, last + s);
}
}
return int(A.size()) + add;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |