# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
304397 | QAQAutoMaton | 버섯 세기 (IOI20_mushrooms) | C++17 | 12 ms | 396 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "mushrooms.h"
#include<algorithm>
int min(int x,int y){return x<y?x:y;}
int count_mushrooms(int n) {
std::vector<int> A({0}),B(0),ask;
int ans=1;
int at=1;
while(at<n){
ask.clear();
if(A.size()>B.size()){
int m=min(A.size(),n-at);
for(int i=0;i<m;++i){
ask.emplace_back(at+i);
ask.emplace_back(A[i]);
}
int w=use_machine(ask);
(w&1?B:A).emplace_back(at);
ans+=m-((w+1)>>1);
at+=m;
}else{
int m=min(B.size(),n-at);
for(int i=0;i<m;++i){
ask.emplace_back(at+i);
ask.emplace_back(B[i]);
}
int w=use_machine(ask);
(w&1?A:B).emplace_back(at);
ans+=((w+1)>>1);
at+=m;
}
}
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |