답안 #988509

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
988509 2024-05-25T04:34:11 Z cnn008 드문 곤충 (IOI22_insects) C++17
0 / 100
5 ms 600 KB
#include "bits/stdc++.h"
using namespace std;

#include "insects.h"

#ifdef N_N_C
#include "debug.h"
#else
#define cebug(...) "Arya"
#endif

#define ll long long

const int N=1e5+5;
const int mod=1e9+7;

int cad,vis[1005],type;
int min_cardinality(int n){
	for(int i=0; i<n; i++){
		move_inside(i);
		if(press_button()>cad) cad++,vis[i]=1;
		else move_outside(i);
	}
	for(int i=0; i<n; i++){
		if(vis[i]){
			vis[i]=0;
			move_outside(i);
		}
	}
	if(cad<=30){
		for(int i=0; i<n; i++){
			if(!vis[i]){
				vis[i]=++type;
				move_inside(i);
				for(int j=i+1; j<n; j++){
					move_inside(j);
					int val=press_button();
					if(val==2) vis[j]=type;
					move_outside(j);
				}
				move_outside(i);
			}
		}
		map <int,int> mp;
		for(int i=0; i<n; i++) mp[vis[i]]++;
		int ans=INT_MAX;
		for(auto [x,y]:mp) ans=min(ans,y);
		return ans;
	}else{
		int cnt=0;
		for(int i=0; i<n; i++){
			if(!vis[i]){
				cnt++;
				vis[i]=++type;
				move_inside(i);
				int sz=1;
				for(int j=i+1; j<n; j++){
					move_inside(j);
					if(press_button()>sz){
						sz++;
						vis[j]=type;
					}else move_outside(j);
				}
				if(sz<cad) return cnt-1;
				move_outside(i);
				for(int j=i+1; j<n; j++) if(vis[j]==type) move_outside(j);
			}
		}
		return cnt;
	}
}
/**  /\_/\
*   (= ._.)
*   / >💖 \>💕
**/

Compilation message

insects.cpp:72:9: warning: "/*" within comment [-Wcomment]
   72 | /**  /\_/\
      |
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 1 ms 344 KB Output is correct
3 Correct 1 ms 344 KB Output is correct
4 Correct 1 ms 596 KB Output is correct
5 Correct 1 ms 344 KB Output is correct
6 Incorrect 2 ms 344 KB Wrong answer.
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 1 ms 344 KB Output is correct
3 Correct 1 ms 344 KB Output is correct
4 Correct 1 ms 596 KB Output is correct
5 Correct 1 ms 344 KB Output is correct
6 Incorrect 2 ms 344 KB Wrong answer.
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 1 ms 344 KB Output is correct
3 Correct 1 ms 344 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 1 ms 344 KB Output is correct
6 Correct 1 ms 344 KB Output is correct
7 Runtime error 5 ms 600 KB Execution killed with signal 11
8 Halted 0 ms 0 KB -