QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#141805#4565. Rarest Insectsvalerikk#0 2ms3892kbC++171.5kb2023-08-18 01:17:112024-07-04 01:47:14

Judging History

你现在查看的是最新测评结果

  • [2024-07-04 01:47:14]
  • 评测
  • 测评结果:0
  • 用时:2ms
  • 内存:3892kb
  • [2023-08-18 01:17:11]
  • 提交

answer

#include "insects.h"
#include <bits/stdc++.h>

using namespace std;

namespace {

const int N = 2005;

int n;
int used[N];
vector<int> diff;

}

int min_cardinality(int grdn) {
	n = grdn;
	for (int i = 0; i < n; ++i) {
		move_inside(i);
		if (press_button() > 1) {
			move_outside(i);
		} else {
			used[i] = 1;
			diff.push_back(i);
		}
	}
	int k = diff.size();
	if (k <= 2) {
		for (int i : diff) {
			move_outside(i);
		}
		int ret = n;
		for (int it = 0; it < 100; ++it) {
			vector<int> a;
			for (int i = 0; i < n; ++i) {
				if (!used[i]) {
					a.push_back(i);
				}
			}
			if (a.empty()) {
				break;
			}
			vector<int> b;
			for (int i : a) {
				move_inside(i);
				if (press_button() == (int)b.size() + 1) {
					b.push_back(i);
				} else {
					move_outside(i);
				}
			}
			ret = min(ret, (int)b.size());
			for (int i : b) {
				move_outside(i);
				used[i] = 1;
			}
		}
		return ret;
	}
	int ret = 1;
	int m = n / k - 1;
	while (true) {
		vector<int> a;
		for (int i = 0; i < n; ++i) {
			if (!used[i]) {
				a.push_back(i);
			}
		}
		if ((int)a.size() < k || m == 0) {
			break;
		}
		int x = m * 0.28;
		x = max(x, 1);
		x = min(x, m);
		vector<int> b;
		for (int i : a) {
			move_inside(i);
			if (press_button() - ret > x) {
				move_outside(i);
			} else {
				b.push_back(i);
			}
		}
		if ((int)b.size() == x * k) {
			m -= x;
			ret += x;
			for (int i : b) {
				used[i] = 1;
			}
		} else {
			for (int i : b) {
				move_outside(i);
			}
			m = x - 1;
		}
	}
	return ret;
}

详细

Subtask #1:

score: 0
Wrong Answer

Test #1:

score: 10
Accepted
time: 1ms
memory: 3804kb

input:

6
1
1
1
2
2
2
2
2
3

output:

8
0 0
8
2
8
0 1
8
2
8
0 2
8
2
8
0 3
8
2
8
1 3
8
0 4
8
2
8
1 4
8
0 5
8
2
8
1 5
8
0 3
8
2
8
0 4
8
2
8
0 5
8
2
8
1 5
8
1 3
8
1 4
8
3 1

result:

ok 

Test #2:

score: -10
Wrong Answer
time: 0ms
memory: 3812kb

input:

2
1
2
1

output:

8
0 0
8
2
8
0 1
8
2
8
1 1
8
1 0
8
0 1
8
2
8
1 1
8
3 1

result:

wrong answer Wrong answer.

Subtask #2:

score: 0
Wrong Answer

Test #24:

score: 0
Wrong Answer
time: 2ms
memory: 3892kb

input:

1000
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2...

output:

8
0 0
8
2
8
0 1
8
2
8
1 1
8
0 2
8
2
8
1 2
8
0 3
8
2
8
1 3
8
0 4
8
2
8
1 4
8
0 5
8
2
8
1 5
8
0 6
8
2
8
1 6
8
0 7
8
2
8
1 7
8
0 8
8
2
8
1 8
8
0 9
8
2
8
1 9
8
0 10
8
2
8
1 10
8
0 11
8
2
8
1 11
8
0 12
8
2
8
1 12
8
0 13
8
2
8
1 13
8
0 14
8
2
8
1 14
8
0 15
8
2
8
1 15
8
0 16
8
2
8
1 16
8
0 17
8
2
8
1 17
8
...

result:

wrong answer Wrong answer.

Subtask #3:

score: 0
Wrong Answer

Test #43:

score: 0
Wrong Answer
time: 0ms
memory: 3752kb

input:

2
1
2
1

output:

8
0 0
8
2
8
0 1
8
2
8
1 1
8
1 0
8
0 1
8
2
8
1 1
8
3 1

result:

wrong answer Wrong answer.