답안 #988512

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
988512 2024-05-25T04:41:31 Z cnn008 드문 곤충 (IOI22_insects) C++17
25 / 100
193 ms 920 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[2005],type;
int min_cardinality(int n){
	for(int i=0; i<n; i++){
		move_inside(i);
		if(press_button()==1) 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++){
					if(vis[j]) continue;
					move_inside(j);
					if(press_button()==1){
						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:73:9: warning: "/*" within comment [-Wcomment]
   73 | /**  /\_/\
      |
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 1 ms 344 KB Output is correct
4 Correct 1 ms 344 KB Output is correct
5 Correct 1 ms 344 KB Output is correct
6 Correct 3 ms 504 KB Output is correct
7 Correct 2 ms 344 KB Output is correct
8 Correct 10 ms 344 KB Output is correct
9 Correct 15 ms 344 KB Output is correct
10 Correct 3 ms 344 KB Output is correct
11 Correct 3 ms 344 KB Output is correct
12 Correct 8 ms 344 KB Output is correct
13 Correct 13 ms 344 KB Output is correct
14 Correct 5 ms 344 KB Output is correct
15 Correct 10 ms 344 KB Output is correct
16 Correct 16 ms 344 KB Output is correct
17 Correct 11 ms 344 KB Output is correct
18 Correct 12 ms 344 KB Output is correct
19 Correct 19 ms 344 KB Output is correct
20 Correct 3 ms 344 KB Output is correct
21 Correct 3 ms 344 KB Output is correct
22 Correct 2 ms 344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 1 ms 344 KB Output is correct
4 Correct 1 ms 344 KB Output is correct
5 Correct 1 ms 344 KB Output is correct
6 Correct 3 ms 504 KB Output is correct
7 Correct 2 ms 344 KB Output is correct
8 Correct 10 ms 344 KB Output is correct
9 Correct 15 ms 344 KB Output is correct
10 Correct 3 ms 344 KB Output is correct
11 Correct 3 ms 344 KB Output is correct
12 Correct 8 ms 344 KB Output is correct
13 Correct 13 ms 344 KB Output is correct
14 Correct 5 ms 344 KB Output is correct
15 Correct 10 ms 344 KB Output is correct
16 Correct 16 ms 344 KB Output is correct
17 Correct 11 ms 344 KB Output is correct
18 Correct 12 ms 344 KB Output is correct
19 Correct 19 ms 344 KB Output is correct
20 Correct 3 ms 344 KB Output is correct
21 Correct 3 ms 344 KB Output is correct
22 Correct 2 ms 344 KB Output is correct
23 Correct 10 ms 432 KB Output is correct
24 Correct 10 ms 600 KB Output is correct
25 Correct 76 ms 416 KB Output is correct
26 Correct 81 ms 420 KB Output is correct
27 Correct 13 ms 600 KB Output is correct
28 Correct 13 ms 600 KB Output is correct
29 Correct 27 ms 436 KB Output is correct
30 Correct 14 ms 596 KB Output is correct
31 Correct 25 ms 432 KB Output is correct
32 Correct 48 ms 600 KB Output is correct
33 Correct 62 ms 440 KB Output is correct
34 Correct 61 ms 440 KB Output is correct
35 Correct 77 ms 600 KB Output is correct
36 Correct 102 ms 344 KB Output is correct
37 Correct 47 ms 412 KB Output is correct
38 Correct 23 ms 432 KB Output is correct
39 Correct 11 ms 600 KB Output is correct
40 Correct 10 ms 600 KB Output is correct
41 Correct 10 ms 856 KB Output is correct
# 결과 실행 시간 메모리 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 344 KB Output is correct
5 Correct 1 ms 504 KB Output is correct
6 Correct 1 ms 344 KB Output is correct
7 Correct 18 ms 412 KB Output is correct
8 Correct 19 ms 920 KB Output is correct
9 Incorrect 193 ms 416 KB Too many queries.
10 Halted 0 ms 0 KB -