Submission details
Task:Peli
Sender:JuusoH
Submission time:2026-07-02 11:28:48 +0300
Language:C++ (C++17)
Status:READY
Result:0
Feedback
subtaskverdictscore
#10
#20
#30
Test results
testverdicttimesubtask
#1--1, 2, 3details
#2--1, 2, 3details
#3--2, 3details
#4--3details
#5--2, 3details
#6--3details

Code

#include <bits/stdc++.h>

const int size = 2001;

bool lookup[size][size] = {};

void build_lookup() {
    for (int i = 0; i < size; i++) {
        for (int l = 0; l < size; l++) {
            bool res = false;
            if (i == l) {
                res = true;
            } else if (i == 0) {
                res = true;
            } else if (l == 0) {
                res = true;
            } else {
                for (int x = 0; x < i; x++) {
                    if (lookup[i - x - 1][l] == false) {
                        res = true;
                        break;
                    }
                }
                if (res == false) {
                    for (int y = 0; y < l; y++) {
                        if (lookup[i][l - y - 1] == false) {
                            res = true;
                            break;
                        }
                    }
                }
                if (res == false) {
                    for (int z = 1; z < std::min(i, l); z++) {
                        int x = i - z;
                        int y = l - z;
                        if (lookup[x][y] == false) {
                            res = true;
                            break;
                        }
                    }
                }
            }
            lookup[i][l] = res;
        }
    }
    std::cout << "ready\n";
}

bool test(int a, int b) {
    return lookup[a][b];
}

int main() {
    build_lookup();

    int tests;
    std::cin >> tests;

    for (int i = 0; i < tests; i++) {
        int a, b;
        std::cin >> a >> b;
        if (test(a, b)) {
            std::cout << "first";
        } else {
            std::cout << "second";
        }
    }

    return 0;
}

Test details

Test 1 (public)

Subtask: 1, 2, 3

Verdict:

input
5
2 2
1 2
3 2
4 3
...

correct output
first
second
first
first
second

user output
(empty)

Test 2

Subtask: 1, 2, 3

Verdict:

input
100
1 1
1 2
1 3
1 4
...

correct output
first
second
first
first
first
...

user output
(empty)

Test 3

Subtask: 2, 3

Verdict:

input
1000
82 14
91 84
13 97
92 23
...

correct output
first
first
first
first
first
...

user output
(empty)

Test 4

Subtask: 3

Verdict:

input
1000
1630 271
1812 1671
254 1938
1827 443
...

correct output
first
first
first
first
first
...

user output
(empty)

Test 5

Subtask: 2, 3

Verdict:

input
1000
36 14
79 81
93 82
32 1
...

correct output
first
first
first
first
first
...

user output
(empty)

Test 6

Subtask: 3

Verdict:

input
1000
486 300
899 1455
879 543
40 65
...

correct output
second
second
second
second
second
...

user output
(empty)