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<bits/stdc++.h>
#include "insects.h"
using namespace std;
int All_type[2000]={0};
int Box[2000]={0};
int Check[2000]={0};
int min_cardinality(int N){
int level_1;
for(int j=0;j<N;j++){
int tmp;
if(!All_type[j]){
move_inside(j);
tmp=press_button();
if(tmp>1){
move_outside(j);
}
else{
Check[j]=1;
}
}
}
int Count=0;
for(int j=0;j<N;j++){
if(Check[j]==1) {
move_outside(j);
Check[j]=0;
Count++;
}
}
level_1=Count;
//
if(level_1>32){
for(int i=2;i<=N;i++){
for(int j=0;j<N;j++){
int tmp;
if(!All_type[j]){
move_inside(j);
tmp=press_button();
if(tmp>i){
move_outside(j);
}
else{
Check[j]=1;
}
}
}
int Count=0;
for(int j=0;j<N;j++){
if(Check[j]==1) {
move_outside(j);
Check[j]=0;
Count++;
}
}
if(Count<level_1*i) return i-1;
}
return N;
}
else{
int Count=1;
for(int i=0;i<N;i++){
int Now=0;
for(int j=0;j<N;j++){
int tmp;
if(!All_type[j]){
move_inside(j);
tmp=press_button();
if(tmp==Now){
move_outside(j);
}
else{
Check[j]=1;
Now++;
}
}
}
for(int j=0;j<N;j++){
if(Check[j]==1) {
move_outside(j);
Check[j]=0;
All_type[j]=Count;
}
}
Count++;
}
int Min=2000;
for(int i=1;i<=N;i++){
int tmp=0;
for(int j=0;j<N;j++){
if(All_type[j]==i) tmp++;
}
if(tmp!=0) Min=min(tmp,Min);
}
return Min;
}
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |