이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "insects.h"
#include<bits/stdc++.h>
using namespace std;
int min_cardinality(int n){
vector<int> v;
vector<int> s(n, 1);
for (int i=0; i<n; i++) v.push_back(i);
for (int i=0; i<n-1; i++){
if (v[i] < i) continue;
for (int j=0; j<n; j++){
if (v[j] >= i) move_inside(j);
}
int x = press_button();
for (int j=0; j<n; j++){
if (v[j] >= i) move_outside(j);
}
if (x == 1) break;
int y = 1;
move_inside(i);
for (int j=i+1; j<n; j++){
if (v[j] < j) continue;
move_inside(j);
if (press_button() == 2){
s[v[j]]--;
s[v[i]]++;
v[j] = v[i];
y++;
if (y == x) break;
}
move_outside(j);
}
move_outside(i);
}
int bsf = n;
for (int i=0; i<n; i++){
if (s[i] != 0) bsf = min(bsf, s[i]);
}
return bsf;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |