Submission details
Task:Peli
Sender:JuusoH
Submission time:2026-07-02 11:56:19 +0300
Language:C++ (C++17)
Status:READY
Result:100
Feedback
subtaskverdictscore
#1ACCEPTED17
#2ACCEPTED38
#3ACCEPTED45
Test results
testverdicttimesubtask
#1ACCEPTED0.01 s1, 2, 3details
#2ACCEPTED0.01 s1, 2, 3details
#3ACCEPTED0.02 s2, 3details
#4ACCEPTED0.02 s3details
#5ACCEPTED0.02 s2, 3details
#6ACCEPTED0.02 s3details

Code

#include <bits/stdc++.h>

#include <iostream>

using namespace std;

const int b_size = 2001;

bool lookup[b_size][b_size], col[b_size], row[b_size], diag[2 * b_size + 3];

int get_diag(int a, int b) {
    return 2000 + a - b;
}
void build_lookup() {
    for (int i = 0; i < b_size; i++) {
        for (int l = 0; l < b_size; l++) {
            bool res = false;
            if (i == l) {
                res = true;
            } else if (i == 0) {
                res = true;
            } else if (l == 0) {
                res = true;
            } else if (col[l] || row[i] || diag[get_diag(i, l)]) {
                res = true;
            }

            if (!res) {
                col[l] = true;
                row[i] = true;
                diag[get_diag(i, l)] = true;
            }
            lookup[i][l] = res;
        }
    }
}

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

int main() {
    build_lookup();

    int tests;
    cin >> tests;

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

    return 0;
}

Test details

Test 1 (public)

Subtask: 1, 2, 3

Verdict: ACCEPTED

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

correct output
first
second
first
first
second

user output
first
second
first
first
second

Test 2

Subtask: 1, 2, 3

Verdict: ACCEPTED

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

correct output
first
second
first
first
first
...

user output
first
second
first
first
first
...

Test 3

Subtask: 2, 3

Verdict: ACCEPTED

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

correct output
first
first
first
first
first
...

user output
first
first
first
first
first
...

Test 4

Subtask: 3

Verdict: ACCEPTED

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

correct output
first
first
first
first
first
...

user output
first
first
first
first
first
...

Test 5

Subtask: 2, 3

Verdict: ACCEPTED

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

correct output
first
first
first
first
first
...

user output
first
first
first
first
first
...

Test 6

Subtask: 3

Verdict: ACCEPTED

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

correct output
second
second
second
second
second
...

user output
second
second
second
second
second
...