QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#527754#4565. Rarest Insectsarbuzick#0 1ms4136kbC++201.7kb2024-08-22 19:04:562024-08-22 19:04:57

Judging History

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

  • [2024-08-22 19:04:57]
  • 评测
  • 测评结果:0
  • 用时:1ms
  • 内存:4136kb
  • [2024-08-22 19:04:56]
  • 提交

answer

#include "insects.h"

#include <bits/stdc++.h>

using namespace std;

int min_cardinality(int n) {
    vector<int> nw;
    for (int i = 0; i < n; ++i) {
        move_inside(i);
        nw.push_back(i);
    }
    mt19937 rnd(57);
    while (true) {
        shuffle(nw.begin(), nw.end(), rnd);
        vector<int> deleted;
        int mx_card = press_button();
        if (mx_card == (int)nw.size() || mx_card == 1) {
            return mx_card;
        }
        while (true) {
            move_outside(nw.back());
            deleted.push_back(nw.back());
            nw.pop_back();
            if (press_button() < mx_card) {
                break;
            }
        }
        vector<int> all_types;
        while (!deleted.empty()) {
            move_inside(deleted.back());
            if (press_button() == mx_card) {
                move_outside(deleted.back());
                all_types.push_back(deleted.back());
            } else {
                nw.push_back(deleted.back());
            }
            deleted.pop_back();
        }
        if (all_types.size() * mx_card == all_types.size() + nw.size()) {
            return mx_card;
        }
        for (auto insect : nw) {
            move_outside(insect);
        }
        for (auto insect : all_types) {
            move_inside(insect);
        }
        vector<int> nw2;
        while (!nw.empty()) {
            move_inside(nw.back());
            if (press_button() == 1) {
                nw2.push_back(nw.back());
                move_outside(nw.back());
            } else {
                move_outside(nw.back());
            }
            nw.pop_back();
        }
        nw = nw2;
    }
}

详细

Subtask #1:

score: 0
Wrong Answer

Test #1:

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

input:

6
3
3
2
3
2
1
1
1
2
2
1

output:

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

result:

ok 

Test #2:

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

input:

2
2

output:

8
0 0
8
0 1
8
2
8
3 2

result:

ok 

Test #3:

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

input:

2
1

output:

8
0 0
8
0 1
8
2
8
3 1

result:

ok 

Test #4:

score: 10
Accepted
time: 0ms
memory: 3796kb

input:

3
2
1
2
1
2
1

output:

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

result:

ok 

Test #5:

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

input:

5
3
2
3
1
2
2
1
1

output:

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

result:

wrong answer Wrong answer.

Subtask #2:

score: 0
Wrong Answer

Test #24:

score: 15
Accepted
time: 1ms
memory: 4128kb

input:

1000
1000

output:

8
0 0
8
0 1
8
0 2
8
0 3
8
0 4
8
0 5
8
0 6
8
0 7
8
0 8
8
0 9
8
0 10
8
0 11
8
0 12
8
0 13
8
0 14
8
0 15
8
0 16
8
0 17
8
0 18
8
0 19
8
0 20
8
0 21
8
0 22
8
0 23
8
0 24
8
0 25
8
0 26
8
0 27
8
0 28
8
0 29
8
0 30
8
0 31
8
0 32
8
0 33
8
0 34
8
0 35
8
0 36
8
0 37
8
0 38
8
0 39
8
0 40
8
0 41
8
0 42
8
0 43
8
...

result:

ok 

Test #25:

score: 15
Accepted
time: 1ms
memory: 3868kb

input:

1000
1

output:

8
0 0
8
0 1
8
0 2
8
0 3
8
0 4
8
0 5
8
0 6
8
0 7
8
0 8
8
0 9
8
0 10
8
0 11
8
0 12
8
0 13
8
0 14
8
0 15
8
0 16
8
0 17
8
0 18
8
0 19
8
0 20
8
0 21
8
0 22
8
0 23
8
0 24
8
0 25
8
0 26
8
0 27
8
0 28
8
0 29
8
0 30
8
0 31
8
0 32
8
0 33
8
0 34
8
0 35
8
0 36
8
0 37
8
0 38
8
0 39
8
0 40
8
0 41
8
0 42
8
0 43
8
...

result:

ok 

Test #26:

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

input:

999
33
33
33
33
33
33
33
33
33
33
33
33
33
33
33
33
33
33
33
33
33
33
33
33
33
33
33
33
33
33
33
33
33
33
33
33
33
33
33
33
33
33
33
33
33
33
33
33
33
33
33
33
33
33
33
33
33
33
33
33
33
33
33
33
33
33
33
33
33
33
33
33
33
33
33
33
33
33
33
33
33
33
33
33
33
33
33
33
33
33
33
33
33
33
33
33
33
33
33...

output:

8
0 0
8
0 1
8
0 2
8
0 3
8
0 4
8
0 5
8
0 6
8
0 7
8
0 8
8
0 9
8
0 10
8
0 11
8
0 12
8
0 13
8
0 14
8
0 15
8
0 16
8
0 17
8
0 18
8
0 19
8
0 20
8
0 21
8
0 22
8
0 23
8
0 24
8
0 25
8
0 26
8
0 27
8
0 28
8
0 29
8
0 30
8
0 31
8
0 32
8
0 33
8
0 34
8
0 35
8
0 36
8
0 37
8
0 38
8
0 39
8
0 40
8
0 41
8
0 42
8
0 43
8
...

result:

wrong answer Wrong answer.

Subtask #3:

score: 0
Wrong Answer

Test #43:

score: 75
Accepted
time: 0ms
memory: 4084kb

input:

2
2

output:

8
0 0
8
0 1
8
2
8
3 2

result:

ok 

Test #44:

score: 75
Accepted
time: 1ms
memory: 3904kb

input:

2
1

output:

8
0 0
8
0 1
8
2
8
3 1

result:

ok 

Test #45:

score: 75
Accepted
time: 1ms
memory: 3808kb

input:

3
2
1
2
1
2
1

output:

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

result:

ok 

Test #46:

score: 75
Accepted
time: 0ms
memory: 3820kb

input:

6
5
4
5
1
2
2
2
2
1

output:

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

result:

ok 

Test #47:

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

input:

10
6
6
6
5
6
5
5
1
1
2
1
1
2
2
2
2
1

output:

8
0 0
8
0 1
8
0 2
8
0 3
8
0 4
8
0 5
8
0 6
8
0 7
8
0 8
8
0 9
8
2
8
1 2
8
2
8
1 3
8
2
8
1 6
8
2
8
0 6
8
2
8
1 6
8
0 3
8
2
8
0 2
8
2
8
1 5
8
1 4
8
1 0
8
1 8
8
1 7
8
1 1
8
1 9
8
1 3
8
1 2
8
0 6
8
0 2
8
2
8
1 2
8
0 3
8
2
8
1 3
8
0 9
8
2
8
1 9
8
0 1
8
2
8
1 1
8
0 7
8
2
8
1 7
8
0 8
8
2
8
1 8
8
0 0
8
2
8
1 ...

result:

wrong answer Wrong answer.