답안 #1079884

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1079884 2024-08-29T02:58:36 Z Gromp15 드문 곤충 (IOI22_insects) C++17
0 / 100
39 ms 660 KB
#include <bits/stdc++.h>
#define sz(x) (int)x.size()
#define all(x) x.begin(), x.end()
#include "insects.h"
using namespace std;
template<typename T> bool ckmin(T &a, const T &b) { return a > b ? a = b, 1 : 0; }
template<typename T> bool ckmax(T &a, const T &b) { return a < b ? a = b, 1 : 0; }

int min_cardinality(int N) {
	vector<int> groups{0};
	move_inside(0);
	for (int i = 1; i < N; i++) {
		move_inside(i);
		if (press_button() > 1) move_outside(i);
		else groups.push_back(i);
	}
	vector<int> pot(N);
	iota(all(pot), 0);
	int l = 2, r = sz(pot) / sz(groups), ans = 1;
	vector<int> got{groups};
	while (l <= r) {
		int mid = (l+r)/2;
		auto orig = got;
		for (int x : pot) {
			if (find(all(got), x) != got.end()) { 
				continue;
			}
			move_inside(x);
			if (press_button() > mid) move_outside(x);
			else got.push_back(x);
		}
		if (sz(got) == mid * sz(groups)) { 
			ans = mid, l = mid+1;
		}
		else { 
			r = mid-1;
			for (int x : got) move_outside(x);
			swap(pot, got);
			swap(got, orig);
		}
	}
	return ans;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 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 440 KB Output is correct
7 Correct 2 ms 344 KB Output is correct
8 Correct 4 ms 344 KB Output is correct
9 Incorrect 3 ms 344 KB Wrong answer.
10 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 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 440 KB Output is correct
7 Correct 2 ms 344 KB Output is correct
8 Correct 4 ms 344 KB Output is correct
9 Incorrect 3 ms 344 KB Wrong answer.
10 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 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 1 ms 344 KB Output is correct
5 Correct 0 ms 344 KB Output is correct
6 Correct 0 ms 344 KB Output is correct
7 Correct 39 ms 424 KB Output is correct
8 Correct 8 ms 600 KB Output is correct
9 Correct 23 ms 596 KB Output is correct
10 Partially correct 27 ms 660 KB Output is partially correct
11 Incorrect 27 ms 412 KB Wrong answer.
12 Halted 0 ms 0 KB -