답안 #859353

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
859353 2023-10-10T04:50:03 Z imarn 드문 곤충 (IOI22_insects) C++17
0 / 100
5 ms 344 KB
#include<bits/stdc++.h>
#include "insects.h"
#define f first
#define s second
#define pb push_back
using namespace std;
int siz[2001]{0};
int min_cardinality(int N) {
    vector<int>vec;
    int vis[2001]={0};
    move_inside(0);
    int sz=0;
    for(int i=0;i<N;i++)siz[i]=1;
    for(int i=0;i<N;i++){
    	if(vis[i])continue;
        move_inside(i);
        if(press_button()==1){
            vis[i]=1;sz++;vec.pb(i);
        }
        else move_outside(i);
    }
    int l=1,r=N/sz+1;
    int ans=1;
    int memsize=sz;
    int cnt=0;
    while(l<r){
        int tt=cnt;
        int m=(l+r+1)>>1;
        for(int i=0;i<N;i++){
            if(!vis[i]){
                move_inside(i);
                int y=press_button();
                if(y<=m){
                    cnt++;vis[i]=2;
                }
                else move_outside(i);
            }
        }
        if(cnt/memsize<m-1)r=m-1;
        else l=m,ans=m;
    }return l;
}

Compilation message

insects.cpp: In function 'int min_cardinality(int)':
insects.cpp:27:13: warning: unused variable 'tt' [-Wunused-variable]
   27 |         int tt=cnt;
      |             ^~
insects.cpp:23:9: warning: variable 'ans' set but not used [-Wunused-but-set-variable]
   23 |     int ans=1;
      |         ^~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 0 ms 344 KB Output is correct
6 Correct 3 ms 344 KB Output is correct
7 Correct 1 ms 344 KB Output is correct
8 Correct 2 ms 344 KB Output is correct
9 Correct 3 ms 344 KB Output is correct
10 Incorrect 5 ms 344 KB Wrong answer.
11 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 0 ms 344 KB Output is correct
6 Correct 3 ms 344 KB Output is correct
7 Correct 1 ms 344 KB Output is correct
8 Correct 2 ms 344 KB Output is correct
9 Correct 3 ms 344 KB Output is correct
10 Incorrect 5 ms 344 KB Wrong answer.
11 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Incorrect 0 ms 344 KB Wrong answer.
6 Halted 0 ms 0 KB -