QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#322035#677. Koala GameCamillus47 45ms5100kbC++232.7kb2024-02-06 04:00:202024-02-06 04:00:20

Judging History

This is the latest submission verdict.

  • [2024-02-06 04:00:20]
  • Judged
  • Verdict: 47
  • Time: 45ms
  • Memory: 5100kb
  • [2024-02-06 04:00:20]
  • Submitted

answer

#include "koala.h"
#include "bits/stdc++.h"
using namespace std;

int minValue(int N, int W) {
    vector<int> A(N, 0);
    A[0] = 1;
    vector<int> B(N);
    playRound(A.data(), B.data());
    for (int i = 0; i < N; i++) {
        if (B[i] <= A[i]) {
            return i;
        }
    }
}

int maxValue(int N, int W) {
    vector<int> A(N, 1);
    vector<int> B(N);

    playRound(A.data(), B.data());
    // debug(B);
    playRound(B.data(), A.data());
    for (int i = 0; i < N; i++) {
        if (A[i] == 3) {
            A[i] = 4;
        } else {
            A[i] = 0;
        }
    }
    // debug(A);
    playRound(A.data(), B.data());
    // debug(B);
    for (int i = 0; i < N; i++) {
        if (B[i] == 5) {
            B[i] = 11;
        } else {
            B[i] = 0;
        }
    }
    playRound(B.data(), A.data());
    // debug(A);

    for (int i = 0; i < N; i++) {
        if (A[i] == 12) {
            return i;
        }
    }

    return 0;
}

int greaterValue(int N, int W) {
    vector<int> B(N);
    vector<int> R(N);
	int l = 1, r = 9;
	while (l != r) {
		int mid = (l + r) / 2;
		B[0] = B[1] = mid;
		playRound(B.data(), R.data());

		if (R[0] > mid && R[1] > mid) l = mid + 1;
		else if (R[0] <= mid && R[1] <= mid) r = mid - 1;
		else return (R[0] < R[1]);
	}
	B[0] = B[1] = l;
	playRound(B.data(), R.data());
	return (R[0] < R[1]);
}

int A[100];
int B[100];
int R[100];

void split(vector<int> v, int N, int W, int *P, int l = 1, int r = 100) {
	if (l == r) P[v[0]] = l;
	else {
		int x = W / (r - l + 1);

		fill(B, B + N, 0);
		for (int i : v) B[i] = x;

		playRound(B, R);
		vector<int> less, greater;
		for (int i : v)
			if (R[i] > x) greater.push_back(i);
			else less.push_back(i);

		split(less, N, W, P, l, l + less.size() - 1);
		split(greater, N, W, P, r - greater.size() + 1, r);
	}
}

void allValues(int N, int W, int *P) {
    if (W == 2*N) {
        struct x {
            int i;
            x(int i) : i(i) {}

            bool operator<(const x &other) const {
                memset(A, 0, sizeof(A));
                memset(B, 0, sizeof(B));
                A[i] = 100;
                A[other.i] = 100;
                playRound(A, B);
                return B[other.i] > 100;
            };
        };

        vector<x> a;
        for (int i = 0; i < N; i++) {
            a.emplace_back(i);
        }

        stable_sort(a.begin(), a.end());

        for (int i = 0; i < N; i++) {
            P[a[i].i] = i + 1;
        }
    } else {
        vector<int> v;
		for (int i = 0; i < N; i++) v.push_back(i);
		split(v, N, W, P);
    }
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 4
Accepted

Test #1:

score: 4
Accepted
time: 3ms
memory: 3800kb

input:

1 100 2
100 100 46 17 44 52 18 67 69 100 62 96 33 64 41 47 87 54 99 32 14 4 89 73 70 20 81 42 8 80 65 88 36 11 53 98 56 94 79 57 1 76 31 7 72 13 21 92 86 66 90 24 40 75 68 15 37 25 43 58 60 3 82 85 28 16 71 97 22 38 9 39 48 78 74 91 50 35 29 27 10 12 6 19 5 34 95 59 93 83 30 49 51 61 26 23 77 55 45 ...

output:

1

result:

points 1.0 number of queries is 1

Test #2:

score: 4
Accepted
time: 3ms
memory: 4068kb

input:

1 100 2
100 100 68 30 61 13 87 15 18 63 49 73 82 57 19 45 40 92 48 41 97 31 44 8 71 77 35 65 95 28 6 94 74 7 53 46 81 88 3 91 72 62 36 50 12 21 54 26 24 2 47 80 39 4 55 27 51 70 96 34 89 75 16 29 58 9 98 99 83 33 42 32 11 69 14 5 66 86 100 22 67 38 52 79 59 93 60 56 20 25 76 43 84 90 78 37 1 17 10 2...

output:

1

result:

points 1.0 number of queries is 1

Test #3:

score: 4
Accepted
time: 3ms
memory: 3796kb

input:

1 100 2
100 100 73 64 94 19 67 57 90 6 97 12 15 18 32 95 5 55 76 36 25 75 59 74 49 83 20 99 8 70 33 14 39 10 23 53 79 58 46 47 29 44 88 87 9 1 82 71 38 37 86 51 13 42 93 43 78 30 54 4 98 91 48 62 72 68 56 96 31 17 24 2 35 21 77 81 41 52 69 61 11 84 89 92 50 100 45 22 28 66 65 26 80 27 40 16 60 85 3 ...

output:

1

result:

points 1.0 number of queries is 1

Test #4:

score: 4
Accepted
time: 3ms
memory: 4068kb

input:

1 99 2
100 100 53 64 41 55 63 58 60 56 44 57 61 46 54 49 45 59 47 42 43 40 48 62 50 51 52 36 38 39 33 32 37 34 35 92 91 95 93 94 98 96 97 90 66 68 70 69 67 65 11 12 8 10 9 30 29 31 100 99 6 2 4 7 1 5 3 17 14 13 18 15 19 16 79 84 75 77 85 78 88 72 89 73 87 74 83 86 76 81 71 80 82 25 21 23 24 26 22 28...

output:

1

result:

points 1.0 number of queries is 1

Subtask #2:

score: 15
Accepted

Test #5:

score: 15
Accepted
time: 8ms
memory: 3832kb

input:

2 100 13
100 100 65 36 67 86 38 76 15 17 13 93 83 57 46 90 14 2 52 88 29 74 55 66 79 75 37 81 87 47 56 25 33 39 8 31 64 73 98 78 100 94 10 58 61 70 53 54 21 49 16 5 4 85 44 62 27 92 91 26 72 41 42 99 89 77 12 69 60 24 3 30 40 1 84 68 59 28 11 71 96 97 63 32 18 34 43 82 48 35 95 80 7 45 19 23 51 22 5...

output:

4

result:

points 1.0 number of queries is 4

Test #6:

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

input:

2 100 13
100 100 86 98 14 10 46 93 8 40 9 61 74 35 76 6 53 50 44 88 43 42 84 57 79 39 58 13 28 77 83 16 34 49 71 45 20 64 18 68 24 15 26 38 72 85 82 21 75 52 23 100 37 36 99 12 62 4 33 11 27 81 95 2 70 65 87 30 56 90 48 66 25 41 51 3 92 63 60 80 7 22 19 89 29 94 97 32 31 59 96 91 78 69 5 55 73 67 17...

output:

4

result:

points 1.0 number of queries is 4

Test #7:

score: 15
Accepted
time: 8ms
memory: 3804kb

input:

2 100 13
100 100 86 7 41 38 96 16 6 65 92 85 88 13 80 64 45 37 34 14 44 12 78 66 79 10 3 69 43 91 97 22 11 1 26 56 81 59 39 94 40 9 15 90 48 20 74 68 55 29 2 23 46 93 24 35 95 72 82 31 100 71 52 60 87 89 75 8 57 28 33 63 21 62 84 25 58 47 30 42 61 19 54 17 27 5 36 99 49 51 18 4 98 50 77 76 73 32 83 ...

output:

4

result:

points 1.0 number of queries is 4

Test #8:

score: 15
Accepted
time: 7ms
memory: 3864kb

input:

2 99 13
100 100 64 61 58 62 76 63 68 57 69 66 70 77 67 73 75 60 74 71 72 59 65 3 2 1 50 54 41 46 45 35 55 33 39 44 53 52 40 51 38 56 49 34 37 31 36 42 48 47 43 32 84 98 86 87 99 80 78 100 89 95 93 83 96 92 85 91 97 94 88 90 79 81 82 20 10 9 16 11 17 19 4 7 18 12 13 22 27 8 6 24 29 28 23 15 26 30 25 ...

output:

4

result:

points 1.0 number of queries is 4

Subtask #3:

score: 18
Accepted

Test #9:

score: 18
Accepted
time: 30ms
memory: 3800kb

input:

3 1100 14
100 100 50 78 94 90 6 24 52 93 73 4 7 5 40 2 17 41 27 8 21 16 64 80 96 12 46 57 38 22 69 92 47 10 60 13 76 62 30 74 31 82 91 32 36 53 84 98 44 77 19 49 83 71 79 15 87 37 20 85 48 51 68 55 3 81 1 34 99 97 26 9 75 35 28 56 33 65 54 25 18 66 11 63 43 61 88 45 89 23 39 29 100 58 67 95 42 59 72...

output:

3

result:

points 1.0 number of queries is 3

Test #10:

score: 18
Accepted
time: 35ms
memory: 4076kb

input:

3 999 14
100 100 5 6 45 48 46 44 47 4 2 1 3 39 34 42 37 38 35 43 41 40 36 30 33 32 31 13 8 17 7 11 9 12 23 19 18 10 24 20 26 16 22 14 15 21 25 55 76 49 52 63 62 50 70 66 56 73 53 58 77 75 74 60 72 57 67 68 59 64 61 69 54 65 51 71 28 29 27 94 96 93 92 100 91 97 98 95 99 78 89 88 84 86 79 81 85 83 90 ...

output:

3

result:

points 1.0 number of queries is 3

Test #11:

score: 18
Accepted
time: 30ms
memory: 3796kb

input:

3 1100 14
100 100 5 19 35 90 87 82 29 71 99 14 70 15 74 62 79 30 40 68 13 88 2 94 45 4 46 80 92 66 100 98 33 34 39 37 60 59 48 31 28 43 56 57 93 55 95 27 84 11 49 8 63 47 65 41 26 44 12 3 72 17 50 75 86 10 85 36 7 73 81 18 21 64 91 16 53 9 23 78 58 1 97 25 24 38 69 51 42 32 67 77 61 22 96 89 76 6 52...

output:

3

result:

points 1.0 number of queries is 3

Test #12:

score: 18
Accepted
time: 26ms
memory: 4028kb

input:

3 1100 14
100 100 68 13 93 8 76 73 14 27 33 9 78 55 84 66 4 7 98 75 70 81 52 71 34 79 83 12 74 30 23 56 99 58 54 21 46 39 31 41 26 11 65 40 35 96 42 5 6 94 91 22 63 100 95 45 48 87 37 86 38 24 19 44 32 18 67 15 80 51 89 47 10 64 49 59 20 17 29 69 92 25 88 36 1 43 28 90 61 3 2 97 85 16 50 60 57 53 82...

output:

3

result:

points 1.0 number of queries is 3

Test #13:

score: 18
Accepted
time: 30ms
memory: 3808kb

input:

3 1100 14
100 100 96 31 21 50 24 87 17 85 86 42 51 58 75 77 92 81 97 7 82 20 3 29 65 34 98 16 95 73 48 4 10 40 22 28 63 41 13 15 76 30 32 71 47 84 27 52 68 69 25 43 35 70 80 93 74 12 64 6 89 9 37 49 1 2 14 60 11 19 72 45 59 67 23 57 62 55 78 79 61 100 56 66 18 8 53 54 94 38 44 5 36 99 88 33 26 83 46...

output:

3

result:

points 1.0 number of queries is 3

Test #14:

score: 18
Accepted
time: 30ms
memory: 3788kb

input:

3 1100 14
100 100 61 99 28 21 69 44 87 57 84 52 68 82 11 22 94 75 8 43 33 58 81 88 50 16 20 100 47 15 86 23 39 67 56 60 19 26 76 35 12 73 89 38 78 4 55 36 30 48 80 10 9 24 34 91 13 27 98 65 41 97 59 95 37 40 46 63 83 79 42 90 74 62 45 96 70 71 93 1 2 72 14 5 3 77 49 7 29 64 25 6 54 53 18 17 31 92 32...

output:

3

result:

points 1.0 number of queries is 3

Test #15:

score: 18
Accepted
time: 30ms
memory: 4068kb

input:

3 1100 14
100 100 90 81 30 56 19 16 57 69 28 43 85 87 99 91 79 11 39 32 23 5 33 55 86 96 41 20 38 70 22 37 27 53 2 52 31 58 75 26 44 35 8 49 100 65 24 72 42 71 68 94 3 34 9 98 92 64 63 13 76 73 18 36 21 4 66 7 17 83 67 48 84 59 12 51 40 88 15 78 1 45 14 97 80 29 50 77 93 10 54 89 62 25 47 82 46 95 7...

output:

3

result:

points 1.0 number of queries is 3

Test #16:

score: 18
Accepted
time: 32ms
memory: 3800kb

input:

3 1100 14
100 100 20 40 92 95 76 27 8 16 23 54 65 68 81 17 94 48 5 60 28 84 49 37 3 98 90 10 64 24 51 39 1 25 32 87 83 9 89 67 72 7 80 13 42 34 21 29 12 73 6 46 66 18 91 53 55 61 74 88 36 57 4 70 69 50 58 26 82 35 78 79 56 30 43 75 14 15 77 62 19 71 11 93 100 2 97 45 96 41 44 52 86 22 85 31 59 33 38...

output:

3

result:

points 1.0 number of queries is 3

Test #17:

score: 18
Accepted
time: 36ms
memory: 3800kb

input:

3 1100 14
100 100 66 6 98 27 77 4 11 1 28 59 40 61 85 81 50 21 51 78 65 73 62 76 72 71 7 5 57 14 41 94 86 17 96 84 19 24 47 48 37 3 52 95 79 45 46 8 70 58 90 83 91 12 87 97 55 69 15 31 67 74 53 30 64 2 54 33 42 35 89 80 13 92 63 10 16 99 75 68 20 44 23 93 100 29 32 34 25 43 49 9 88 18 38 36 60 82 22...

output:

3

result:

points 1.0 number of queries is 3

Test #18:

score: 18
Accepted
time: 36ms
memory: 4064kb

input:

3 1100 14
100 100 54 92 42 36 93 13 55 65 66 85 60 50 61 63 35 47 51 52 20 31 72 46 26 70 16 17 15 82 4 53 91 80 14 25 62 48 43 41 37 97 24 68 39 19 9 86 76 21 83 73 38 90 78 96 32 5 3 79 58 87 71 74 8 69 2 40 28 75 88 33 64 67 49 44 100 95 27 84 6 23 81 57 98 45 59 7 56 18 89 30 22 29 34 12 11 99 1...

output:

3

result:

points 1.0 number of queries is 3

Subtask #4:

score: 10
Accepted

Test #19:

score: 10
Accepted
time: 13ms
memory: 3864kb

input:

4 1 700
100 200 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98...

output:

386

result:

points 1.0 number of queries is 386

Test #20:

score: 10
Accepted
time: 21ms
memory: 3748kb

input:

4 1 700
100 200 1 65 33 97 17 81 49 9 73 41 25 89 57 5 69 37 21 85 53 13 77 45 29 93 61 3 67 35 99 19 83 51 11 75 43 27 91 59 7 71 39 23 87 55 15 79 47 31 95 63 2 66 34 98 18 82 50 10 74 42 26 90 58 6 70 38 22 86 54 14 78 46 30 94 62 4 68 36 100 20 84 52 12 76 44 28 92 60 8 72 40 24 88 56 16 80 48 3...

output:

625

result:

points 1.0 number of queries is 625

Test #21:

score: 10
Accepted
time: 20ms
memory: 3756kb

input:

4 1 700
100 200 64 96 32 48 80 16 56 88 24 40 72 8 60 92 28 44 76 12 52 84 20 100 36 68 4 62 94 30 46 78 14 54 86 22 38 70 6 58 90 26 42 74 10 50 82 18 98 34 66 2 63 95 31 47 79 15 55 87 23 39 71 7 59 91 27 43 75 11 51 83 19 99 35 67 3 61 93 29 45 77 13 53 85 21 37 69 5 57 89 25 41 73 9 49 81 17 97 ...

output:

619

result:

points 1.0 number of queries is 619

Test #22:

score: 10
Accepted
time: 20ms
memory: 3812kb

input:

4 1 700
100 200 100 47 4 58 60 91 90 22 86 57 2 70 54 24 41 21 67 99 53 32 77 49 51 30 88 97 26 25 9 80 68 42 34 43 35 82 33 87 16 39 40 15 93 37 13 7 63 83 95 18 84 59 11 62 66 31 14 73 72 23 85 56 61 28 36 20 1 69 17 5 50 38 96 27 92 19 75 94 52 81 89 65 44 55 74 10 12 76 8 46 29 64 71 48 3 45 98 ...

output:

602

result:

points 1.0 number of queries is 602

Test #23:

score: 10
Accepted
time: 20ms
memory: 3816kb

input:

4 1 700
100 200 45 25 28 79 14 34 41 87 21 13 70 56 51 83 19 89 80 5 67 57 43 54 91 76 55 23 46 68 90 65 40 96 8 75 69 2 10 42 71 35 30 11 1 52 58 29 92 9 33 6 15 31 16 18 44 3 26 72 60 94 17 12 78 48 88 97 36 99 95 64 93 100 98 85 73 74 47 4 32 7 38 53 81 82 20 86 22 49 24 66 61 39 59 27 77 37 63 5...

output:

597

result:

points 1.0 number of queries is 597

Test #24:

score: 10
Accepted
time: 20ms
memory: 3800kb

input:

4 1 700
100 200 51 7 11 99 78 48 13 14 3 23 6 8 1 85 76 49 24 65 43 83 73 31 36 89 74 67 93 75 50 56 4 95 12 68 30 59 2 29 42 69 19 10 61 20 27 87 66 77 9 98 97 5 46 90 63 52 39 80 32 70 16 100 25 28 58 54 57 47 37 71 38 40 17 44 86 81 45 91 35 60 41 64 94 33 96 62 88 82 18 53 26 92 79 34 21 55 72 1...

output:

606

result:

points 1.0 number of queries is 606

Test #25:

score: 10
Accepted
time: 20ms
memory: 3812kb

input:

4 1 700
100 200 56 1 90 94 18 91 48 87 55 37 51 62 50 77 53 39 95 85 92 89 76 22 57 8 65 78 70 84 60 49 14 35 36 81 11 40 61 100 34 20 97 7 88 9 66 38 27 58 10 16 52 75 67 23 31 15 33 44 5 71 24 13 74 30 17 41 32 96 46 2 59 29 54 99 80 72 68 64 73 86 21 47 83 42 45 25 43 6 3 93 79 82 4 12 19 28 63 6...

output:

607

result:

points 1.0 number of queries is 607

Test #26:

score: 10
Accepted
time: 20ms
memory: 3868kb

input:

4 1 700
100 200 84 5 31 77 30 18 34 3 81 60 85 92 7 89 95 73 40 51 45 62 79 2 8 1 91 96 24 66 19 98 11 86 83 76 56 47 27 15 29 48 33 64 57 82 49 21 36 72 67 35 90 6 88 12 42 37 53 58 61 39 94 74 50 28 55 22 59 10 25 32 9 44 52 26 17 71 46 20 97 13 54 41 99 70 80 38 4 93 100 16 69 75 63 78 87 14 65 4...

output:

609

result:

points 1.0 number of queries is 609

Test #27:

score: 10
Accepted
time: 21ms
memory: 3784kb

input:

4 1 700
100 200 80 46 48 23 18 62 93 7 85 13 67 10 24 33 36 97 100 96 95 37 92 68 28 43 45 44 70 16 20 14 82 19 50 59 41 61 74 38 30 75 39 2 26 77 56 83 1 91 3 84 58 73 42 90 47 64 69 12 53 8 32 11 15 31 57 65 55 6 76 87 71 88 98 29 5 89 63 66 86 81 78 4 25 17 72 22 40 99 54 60 9 49 94 35 52 79 51 2...

output:

600

result:

points 1.0 number of queries is 600

Test #28:

score: 10
Accepted
time: 19ms
memory: 4076kb

input:

4 1 700
100 200 16 69 59 93 91 35 89 31 18 90 40 25 11 67 82 42 92 64 60 94 95 68 97 50 1 32 39 3 83 85 48 13 28 41 27 43 80 54 26 14 12 8 73 7 84 79 87 38 56 78 30 34 63 58 65 46 36 22 76 6 5 55 61 71 44 47 77 99 2 45 100 29 66 96 23 49 20 19 72 37 86 4 10 88 75 57 53 17 24 62 52 70 81 98 21 15 51 ...

output:

583

result:

points 1.0 number of queries is 583

Test #29:

score: 10
Accepted
time: 20ms
memory: 3756kb

input:

4 1 700
100 200 82 86 26 21 4 78 63 1 92 39 81 89 71 76 68 84 83 24 17 8 43 47 62 31 29 100 73 35 50 91 55 60 53 70 79 69 96 3 38 58 98 56 23 37 14 33 95 42 87 90 93 67 94 11 59 25 44 9 77 28 40 2 72 65 41 88 6 52 16 15 18 22 99 48 74 13 75 46 51 64 27 7 85 34 30 10 49 54 80 20 19 32 12 5 61 57 66 9...

output:

625

result:

points 1.0 number of queries is 625

Test #30:

score: 10
Accepted
time: 9ms
memory: 3820kb

input:

4 1 700
100 200 100 99 98 97 96 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 ...

output:

266

result:

points 1.0 number of queries is 266

Test #31:

score: 10
Accepted
time: 19ms
memory: 3792kb

input:

4 1 700
100 200 12 55 23 61 52 39 97 85 35 56 31 88 50 69 43 7 73 77 94 87 2 14 67 68 89 17 6 44 24 72 46 53 16 26 22 32 3 80 75 93 83 9 8 30 59 11 84 48 96 45 54 64 40 78 1 76 98 58 63 37 10 27 95 60 81 65 20 18 47 5 38 49 86 29 21 90 15 92 57 62 82 100 91 41 33 34 25 4 79 51 28 70 99 74 66 13 19 4...

output:

580

result:

points 1.0 number of queries is 580

Test #32:

score: 10
Accepted
time: 17ms
memory: 4080kb

input:

4 1 700
100 200 1 100 3 98 5 96 7 94 9 92 11 90 13 88 15 86 17 84 19 82 21 80 23 78 25 76 27 74 29 72 31 70 33 68 35 66 37 64 39 62 41 60 43 58 45 56 47 54 49 52 51 50 53 48 55 46 57 44 59 42 61 40 63 38 65 36 67 34 69 32 71 30 73 28 75 26 77 24 79 22 81 20 83 18 85 16 87 14 89 12 91 10 93 8 95 6 97...

output:

534

result:

points 1.0 number of queries is 534

Test #33:

score: 10
Accepted
time: 14ms
memory: 3868kb

input:

4 1 700
100 200 99 2 97 4 95 6 93 8 91 10 89 12 87 14 85 16 83 18 81 20 79 22 77 24 75 26 73 28 71 30 69 32 67 34 65 36 63 38 61 40 59 42 57 44 55 46 53 48 51 50 49 52 47 54 45 56 43 58 41 60 39 62 37 64 35 66 33 68 31 70 29 72 27 74 25 76 23 78 21 80 19 82 17 84 15 86 13 88 11 90 9 92 7 94 5 96 3 9...

output:

534

result:

points 1.0 number of queries is 534

Test #34:

score: 10
Accepted
time: 18ms
memory: 3812kb

input:

4 1 700
100 200 81 84 76 82 73 79 74 75 77 80 83 78 36 69 42 24 43 67 64 52 66 45 26 23 70 44 37 30 34 71 72 59 48 61 60 27 53 55 63 54 51 41 25 56 22 62 31 46 35 40 38 57 49 47 50 65 68 33 39 58 29 32 28 99 96 98 93 100 95 97 92 94 91 90 86 85 87 89 88 16 9 4 15 3 13 20 19 1 6 7 14 17 21 18 8 10 12...

output:

562

result:

points 1.0 number of queries is 562

Test #35:

score: 10
Accepted
time: 14ms
memory: 4080kb

input:

4 1 700
100 200 85 86 87 28 33 34 29 32 31 30 18 19 21 17 15 14 16 22 20 95 96 91 97 98 94 92 93 90 99 89 100 88 62 53 72 48 77 78 45 73 52 55 49 83 82 75 68 67 41 59 43 57 60 50 51 46 58 64 84 61 65 44 80 71 76 47 63 81 70 54 74 56 79 40 66 69 42 39 38 27 23 26 24 25 11 1 6 3 12 5 9 10 8 2 13 7 4 3...

output:

549

result:

points 1.0 number of queries is 549

Test #36:

score: 10
Accepted
time: 18ms
memory: 4068kb

input:

4 1 700
100 200 54 61 65 52 68 50 62 67 44 58 66 53 59 60 64 57 48 46 45 49 55 69 63 56 51 47 39 35 32 41 42 40 34 36 38 43 33 37 97 99 100 98 96 90 94 86 93 91 88 89 85 87 92 95 23 18 27 29 31 25 28 20 26 30 21 17 24 19 22 1 3 2 9 8 14 12 10 11 15 13 16 5 4 7 6 74 75 80 70 83 84 82 72 78 73 79 76 7...

output:

546

result:

points 1.0 number of queries is 546

Test #37:

score: 10
Accepted
time: 18ms
memory: 4064kb

input:

4 1 700
100 200 55 63 60 62 53 56 59 61 58 50 49 54 52 51 57 31 32 40 33 37 39 30 38 36 34 35 41 98 100 99 16 15 14 17 23 28 24 26 25 20 27 22 19 21 29 18 91 93 94 87 95 92 88 96 90 89 97 86 1 12 3 10 13 11 7 6 5 8 4 2 9 46 48 47 45 79 83 81 85 80 84 82 73 76 66 75 71 74 68 72 69 67 77 64 70 78 65 4...

output:

557

result:

points 1.0 number of queries is 557

Test #38:

score: 10
Accepted
time: 19ms
memory: 3868kb

input:

4 1 700
100 200 93 97 96 94 95 24 23 37 36 34 35 33 62 60 61 65 63 64 6 2 7 3 5 4 1 8 39 41 40 38 49 50 48 47 52 51 54 46 56 55 53 100 98 99 25 26 58 59 57 70 74 66 69 71 73 68 67 72 75 13 12 11 87 88 92 85 82 89 90 79 80 81 84 91 83 86 78 76 77 16 22 17 18 21 19 20 15 14 27 29 28 10 9 31 32 30 42 4...

output:

555

result:

points 1.0 number of queries is 555

Subtask #5:

score: 0
Wrong Answer

Test #39:

score: 0
Wrong Answer
time: 45ms
memory: 5100kb

input:

4 1 3200
100 100 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 9...

output:

-1

result:

wrong answer