| Task: | Peli |
| Sender: | JuusoH |
| Submission time: | 2026-07-02 11:11:26 +0300 |
| Language: | C++ (C++17) |
| Status: | COMPILE ERROR |
Compiler report
input/code.cpp: In function 'int main()':
input/code.cpp:6:5: error: 'build_lookup' was not declared in this scope
6 | build_lookup();
| ^~~~~~~~~~~~
input/code.cpp:14:13: error: 'test' was not declared in this scope; did you mean 'tests'?
14 | if (test(a, b)) {
| ^~~~
| testsCode
#include <iostream>
bool lookup[2001][2001] = {};
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;
}
void build_lookup() {
for (int i = 0; i < 2001; i++) {
for (int l = 0; l < 2001; 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[x][l] == false) {
res = true;
break;
}
}
if (res == false) {
for (int y = 0; y < l; y++) {
if (lookup[i][y] == false) {
res = true;
break;
}
}
}
}
lookup[i][l] = res;
}
}
}
bool test(int a, int b) {
return lookup[a][b];
}