# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
830500 | tolbi | 드문 곤충 (IOI22_insects) | C++17 | 247 ms | 304 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
#include "insects.h"
int min_cardinality(int n) {
vector<int> par(n);
function<int(int)> find = [&](int node)->int{
if (par[node]==node) return node;
return par[node]=find(par[node]);
};
vector<int> sz(n,1);
iota(par.begin(), par.end(), 0);
vector<int> crr;
function<int()> findx;
findx = [&]()->int{
for (int i = 0; i < crr.size(); i++){
move_outside(crr[i]);
if (press_button()==1){
for (int j=0;j<=i;j++){
move_inside(crr[j]);
}
return i;
}
}
return 23;
};
for (int i = 0; i < n; i++){
move_inside(i);
if (press_button()>1){
int pos = crr[findx()];
par[i]=find(pos);
sz[find(pos)]++;
sz[i]=0;
move_outside(i);
}
else crr.push_back(i);
}
int ans = n;
for (int i = 0; i < n; i++){
if (par[i]!=i) continue;
ans=min(ans,sz[i]);
}
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... |