Submission details
Task:Peli
Sender:JuusoH
Submission time:2026-07-02 11:26:41 +0300
Language:C++ (C++17)
Status:COMPILE ERROR

Compiler report

input/code.cpp: In function 'void build_lookup()':
input/code.cpp:33:41: error: '__min' was not declared in this scope
   33 |                     for (int z = 1; z < __min(i, l); z++) {
      |                                         ^~~~~

Code

#include <iostream>

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 < __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;
}