# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
726328 | Khizri | 드문 곤충 (IOI22_insects) | C++17 | 237 ms | 596 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "insects.h"
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define F first
#define S second
#define INF 1e18
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define pii pair<int,int>
#define pll pair<ll,ll>
#define OK cout<<"Ok"<<endl;
#define MOD (ll)(1e9+7)
#define endl "\n"
int sz,n;
set<int>ST;
bool check(int k){
if(k==1) return true;
set<int>st=ST,st2;
if(!st.count(0)){
move_inside(0);
st.insert(0);
st2.insert(0);
}
for(int i=1;i<n;i++){
if(!st.count(i)){
move_inside(i);
st.insert(i);
st2.insert(i);
if(press_button()>k){
st.erase(i);
st2.erase(i);
move_outside(i);
}
}
}
bool ok=false;
if(st.size()==sz*k){
ok=true;
}
while(st2.size()&&!ok){
move_outside(*st2.begin());
st.erase(*st2.begin());
st2.erase(st2.begin());
}
ST=st;
return ok;
}
int min_cardinality(int N) {
n=N;
set<int>st;
move_inside(0);
st.insert(0);
for(int i=1;i<n;i++){
move_inside(i);
st.insert(i);
if(press_button()>1){
move_outside(i);
st.erase(i);
}
}
sz=st.size();
while(st.size()){
move_outside(*st.begin());
st.erase(st.begin());
}
int l=1,r=n/sz+1;
while(l<=r){
int m=(l+r)/2;
if(check(m)){
l=m+1;
}
else{
r=m-1;
}
}
return l-1;
}
컴파일 시 표준 에러 (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... |