Submission #985296

#TimeUsernameProblemLanguageResultExecution timeMemory
985296AybakGame (APIO22_game)C++17
12 / 100
100 ms262144 KiB
#include <cstdio> #include <cstdlib> #include <iostream> #include <vector> #include <string> bool** arr; int n; int k; /* 6 5 3 3 4 5 0 4 5 5 3 1 4 */ #define print(var) std::cout << var #define printl(var) std::cout << var << '\n' #define For(i, n) for (int i = 0; i < n; ++i) void Print() { return; For(y, n) { For(x, n) { print(arr[x][y] << " "); } printl(""); } printl("-------------"); } void init(int nH, int kH) { n = nH; k = kH; arr = new bool*[n]; For(x, n) { For(y, n) { arr[x] = new bool[n]{}; } } For(x, k - 1) { for (int y = x + 1; y < k; ++y) { arr[x][y] = 1; } } Print(); } void add(int x1, int x2) { bool change = 0; For(i, n) { if (arr[x2][i] == 1 && arr[x1][i] == 0) { change = 1; arr[x1][i] = arr[x1][i] || arr[x2][i]; } } if (change == 0) { return; } For(i, n) { if (arr[i][x1] == true) { add(i, x1); } } } bool check() { For(x, k) { For(y, x + 1) { if (arr[x][y] == 1) { return 1; } } } return 0; } int add_teleporter(int x, int y) { arr[x][y] = 1; add(x, y); Print(); return check(); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...