# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
533325 | fhvirus | Navigation 2 (JOI21_navigation2) | C++17 | 1 ms | 196 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "Anna.h"
#include <cmath>
#include <vector>
namespace {
const int kMark = 13;
std::vector<std::vector<int>> flag;
void init(const int& N) {
flag.assign(N, std::vector<int>(N, 0));
}
int get_val(const int& i, const int& j, const int& r, const int& c) {
if (j <= c - 2) return 9;
if (j >= c + 2) return 10;
if (i <= r - 2) return 11;
if (i >= r + 2) return 12;
int di = i - r, dj = j - c;
int val = (di + 1) * 3 + (dj + 1) + 1;
return (val == 9 ? -1 : val);
}
bool solve(const int& N, const int& K, const std::vector<int>& R, const std::vector<int>& C, const int& offset) {
for (int i = 0; i < N; ++i)
for (int j = 0; j < N; ++j) {
int k = ((i + offset / 3) % 3) * 3 + ((j + offset % 3) % 3);
flag[i][j] = (k < 7 ? get_val(i, j, R[k], C[k]) : (k == 8 ? kMark : 0));
if (flag[i][j] == -1) return false;
}
return true;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |