# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
859261 | kim | 드문 곤충 (IOI22_insects) | C++17 | 112 ms | 1392 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "insects.h"
#include<bits/stdc++.h>
using namespace std;
#define in move_inside
#define press press_button
#define out move_outside
vector<int> vec0;
set<int> mp;
int p;
int n;
bool check(int k){
stack<int> st;
for(int i=0;i<n;++i){
if(mp.count(i)) continue;
in(i), st.push(i);
if(press()>k) out(i),st.pop();
}
int cnt=st.size()+p;
while(!st.empty()){
out(st.top());
st.pop();
}
if(cnt==p*k) return 1;
return 0;
}
int min_cardinality(int N){
n=N;
for(int i=0;i<n;++i){
in(i), vec0.push_back(i);
if(press()>1) out(i),vec0.pop_back();
}
p=vec0.size();
for(auto &e:vec0) mp.insert(e); //out(e);
int l=1,r=n/p;
while(l<r){
int mid=l+(r-l+1>>1);
if(check(mid)) l=mid;
else r=mid-1;
}
return l;
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |