QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#139460#4565. Rarest Insectspandapythoner#0 3ms4092kbC++171.2kb2023-08-13 16:54:292024-07-04 01:41:00

Judging History

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

  • [2024-07-04 01:41:00]
  • 评测
  • 测评结果:0
  • 用时:3ms
  • 内存:4092kb
  • [2023-08-13 16:54:29]
  • 提交

answer

#include <bits/stdc++.h>

#include "insects.h"

using namespace std;

#define ll long long
#define flt double
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()

const ll inf = 1e18;
mt19937 rnd(234);

int n;

int solve_slow() {
    vector<int> biba(n);
    int clrs = 0;
    for (int i = 0; i < n; i += 1) {
        move_inside(i);
        int x = press_button();
        if (x >= 2) {
            move_outside(i);
            biba[i] = 1;
            clrs += 1;
        } else {
            biba[i] = 0;
        }
    }
    int l = 1;
    int r = n / clrs + 1;
    while (l + 1 < r) {
        int m = (l + r) / 2;
        vector<int> to_dl;
        int cnt = clrs;
        for (int i = 0; i < n; i += 1) {
            if (biba[i] == 0) {
                move_inside(i);
            }
            int x = press_button();
            if (x > m) {
                move_outside(i);
            } else {
                to_dl.push_back(i);
                cnt += 1;
            }
        }
        if (cnt == clrs * m) {
            l = m;
        } else {
            r = m;
        }
    }
    return l;
}

int min_cardinality(int N) {
    n = N;
    int rs = solve_slow();
    return rs;
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 0
Wrong Answer

Test #1:

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

input:

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

result:

ok 

Test #2:

score: -10
Wrong Answer
time: 1ms
memory: 3816kb

input:

2
1
2
1
1

output:

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

result:

wrong answer Wrong answer.

Subtask #2:

score: 0
Wrong Answer

Test #24:

score: 0
Wrong Answer
time: 3ms
memory: 3844kb

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: 1ms
memory: 3884kb

input:

2
1
2
1
1

output:

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

result:

wrong answer Wrong answer.