# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1137306 | nathan4690 | Navigation 2 (JOI21_navigation2) | C++20 | 0 ms | 816 KiB |
#include "Anna.h"
#include <bits/stdc++.h>
using namespace std;
namespace {
using namespace std;
int findFlag(int r, int c, int tarr, int tarc, int m1, int m2){
if(max(abs(tarr - r), abs(tarc - c)) <= 1){
int xm1 = m1 / 3, ym1 = m1 % 3, xm2 = m2 / 3, ym2 = m2 % 3;
tarr = (tarr + 3000) % 3; tarc = (tarc + 3000) % 3;
vector<pair<int,int>> dd = {{-1, 0}, {0, 0}, {1, 0}, {-1, -1}, {0, -1}, {1, -1}, {-1, 1}, {0, 1}, {1, 1}};
int idx = 0;
for(pair<int,int> d: dd){
int nx = (r + d.first + 3) % 3, ny = (c + d.second + 3) % 3;
if(nx == xm1 && ny == ym1) continue;
if(nx == xm2 && ny == ym2) continue;
idx++;
if(tarr == nx && tarc == ny) return idx;
}
}
if(tarr < r - 1) return 8;
if(tarr > r + 1) return 10;
if(tarc < c - 1) return 11;
return 9;
}
void checkPos(int &m1, int &m2){
int xa = m1 / 3, ya = m1 % 3, xb = m2 / 3, yb = m2 % 3;
vector<pair<int,int>> dd = {{0, 1}, {1, 0}, {1, -1}, {1, 1}};
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |