# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1025198 | Wansur | Rarest Insects (IOI22_insects) | C++17 | 48 ms | 944 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#define ent '\n'
void move_inside(int i);
void move_outside(int i);
int press_button();
using namespace std;
typedef long long ll;
const int maxn = 1e5 + 12;
mt19937 rng(10223431);
bool used[maxn];
vector<int> p, d, a, b;
int n, m, c, cnt;
bool check(int x){
x -= cnt;
for(int x:a){
move_outside(x);
}
a.clear();
b.clear();
for(int i:p){
if(used[i]) continue;
move_inside(i);
if(press_button() > x){
move_outside(i);
b.push_back(i);
}
else a.push_back(i);
if(a.size() == x * m) break;
}
if(a.size() == x * m){
cnt += x;
for(int x:a){
used[x] = 1;
c--;
}
return 1;
}
for(int x:b){
used[x] = 1;
c--;
}
return 0;
}
int min_cardinality(int N){
n = N;
c = n;
for(int i=0;i<n;i++){
p.push_back(i);
move_inside(i);
if(press_button() != 1){
move_outside(i);
}
else m++;
}
for(int i=0;i<n;i++){
swap(p[i], p[rng() % n]);
}
int ans = 0;
for(int l = 1, r = n / m; l <= r;){
int mid = l + r >> 1;
if(check(mid)){
ans = mid;
l = mid + 1;
}
else r = mid - 1;
}
return ans;
}
컴파일 시 표준 에러 (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... |