# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
830913 | tolbi | 드문 곤충 (IOI22_insects) | C++17 | 113 ms | 420 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
mt19937 ayahya(chrono::high_resolution_clock().now().time_since_epoch().count());
#include "insects.h"
int min_cardinality(int n) {
function<int(int)> f;
set<int> olan;
for (int i = 0; i < n; ++i)
{
olan.insert(i);
}
vector<int> kullandim;
vector<int> kullanmadim;
f = [&](int x)->int{
int ans = 0;
vector<int> crr;
for (auto it : olan){
crr.push_back(it);
move_inside(it);
if (press_button()>x){
crr.pop_back();
kullanmadim.push_back(it);
move_outside(it);
}
else kullandim.push_back(it),ans++;
}
for (int i = 0; i < crr.size(); ++i)
{
move_outside(crr[i]);
}
return ans;
};
int diff = f(1);
kullanmadim.clear();
kullandim.clear();
if (diff==1) return n;
int l = 1, r = n;
int hueh = 0;
int hehe = 0;
while (l<r){
int mid = l+(r-l)/2;
int hayda = f(mid-hehe);
//cout<<l<<" "<<r<<" "<<mid<<" "<<hayda<<" "<<hueh<<endl;
if (hayda+hueh<(mid*diff)){
r=mid;
for (auto &it : kullanmadim){
olan.erase(it);
}
}
else {
l = mid+1;
hueh+=hayda;
hehe+=mid;
for (auto &it : kullandim){
olan.erase(it);
}
}
kullandim.clear();
kullanmadim.clear();
}
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... |