QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#430577#4565. Rarest Insectsjames1BadCreeper0 3ms3840kbC++141.2kb2024-06-04 00:23:592024-06-04 00:24:00

Judging History

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

  • [2024-06-04 00:24:00]
  • 评测
  • 测评结果:0
  • 用时:3ms
  • 内存:3840kb
  • [2024-06-04 00:23:59]
  • 提交

answer

#include "insects.h"
#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
mt19937 Rnd(time(0)); 

int k, cnt, a[N];
bool vs[N], vs1[N];

inline void ins(int x) { ++cnt; move_inside(x - 1); }
inline void del(int x) { --cnt; move_outside(x - 1); }
int min_cardinality(int n) {
    for (int i = 1; i <= n; ++i) {
        ins(i);
        if (press_button() > 1) del(i);
        else vs[i] = 1, ++k; 
    }
    if (k == 1) return n; 
    int l = 1, r = n / k + 1;
    while (l + 1 != r) {
        int mid = l + r >> 1; 
        for (int i = 1; i <= n; ++i)
            vs1[i] = 0, a[i] = i;
        shuffle(a + 1, a + n + 1, Rnd);
        for (int i = 1; i <= n; ++i) if (!vs[a[i]]) {
            if (k * mid == cnt) break;
            ins(a[i]); 
            if (press_button() > mid) del(a[i]); 
            else vs1[a[i]] = 1; 
        }

        if (k * mid == cnt) {
            l = mid; 
            for (int i = 1; i <= n; ++i)
                if (vs1[i]) vs[i] = 1; 
        } else {
            r = max(l + 1, min(mid, cnt / k)); 
            for (int i = 1; i <= n; ++i)
                if (vs1[i]) del(i); 
                else vs[i] = 1; 
        }
    }
    return r;
}

详细

Subtask #1:

score: 0
Wrong Answer

Test #1:

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

input:

6
1
1
1
2
2
2
2
3
2

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 4
8
2
8
0 5
8
2
8
1 5
8
0 3
8
2
8
1 3
8
1 4
8
3 2

result:

wrong answer Wrong answer.

Subtask #2:

score: 0
Wrong Answer

Test #24:

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

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:

ok 

Test #25:

score: -15
Wrong Answer
time: 3ms
memory: 3808kb

input:

1000
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1...

output:

8
0 0
8
2
8
0 1
8
2
8
0 2
8
2
8
0 3
8
2
8
0 4
8
2
8
0 5
8
2
8
0 6
8
2
8
0 7
8
2
8
0 8
8
2
8
0 9
8
2
8
0 10
8
2
8
0 11
8
2
8
0 12
8
2
8
0 13
8
2
8
0 14
8
2
8
0 15
8
2
8
0 16
8
2
8
0 17
8
2
8
0 18
8
2
8
0 19
8
2
8
0 20
8
2
8
0 21
8
2
8
0 22
8
2
8
0 23
8
2
8
0 24
8
2
8
0 25
8
2
8
0 26
8
2
8
0 27
8
2
8
...

result:

wrong answer Wrong answer.

Subtask #3:

score: 0
Wrong Answer

Test #43:

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

input:

2
1
2

output:

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

result:

ok 

Test #44:

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

input:

2
1
1

output:

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

result:

wrong answer Wrong answer.