This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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... |