# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
666816 | rainboy | Navigation 2 (JOI21_navigation2) | C++17 | 850 ms | 796 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 <vector>
using namespace std;
typedef vector<int> vi;
namespace {}
void Anna(int n, int k, vi ii, vi jj) {
for (int i = 0; i < n; i++)
for (int j = 0; j < n; j++) {
int c = i % 3 * 3 + j % 3;
if (c == 7 || c == 8) {
SetFlag(i, j, 1);
continue;
}
int di = i - ii[c], dj = j - jj[c];
if (di < -1)
SetFlag(i, j, 2);
else if (di > 1)
SetFlag(i, j, 3);
else if (dj < -1)
SetFlag(i, j, 4);
else if (dj > 1)
SetFlag(i, j, 5);
else
SetFlag(i, j, 6 + (di + 1) * 3 + (dj + 1));
}
}
#include "Bruno.h"
#include <vector>
using namespace std;
typedef vector<int> vi;
namespace B {
int aa[3][3];
}
vi Bruno(int k, vi aa_) {
for (int ij = 0; ij < 9; ij++)
B::aa[ij / 3][ij % 3] = aa_[ij];
int i_, j_;
for (i_ = 0; i_ < 3; i_++)
for (j_ = 0; j_ < 3; j_++)
if (B::aa[i_][j_] == 1 && B::aa[i_][(j_ + 1) % 3] == 1) {
i_ = (i_ + 1) % 3, j_ = (j_ + 2) % 3;
goto out;
}
out:
vi dir(k, 0);
for (int h = 0; h < 7; h++) {
int i = (i_ + h / 3) % 3, j = (j_ + h % 3) % 3, a = B::aa[i][j];
if (a == 2)
dir[h] = 2;
else if (a == 3)
dir[h] = 3;
else if (a == 4)
dir[h] = 0;
else if (a == 5)
dir[h] = 1;
else {
a -= 6;
int di = a / 3 - i, dj = a % 3 - j;
if (di < 0)
dir[h] = 2;
else if (di > 0)
dir[h] = 3;
else if (dj < 0)
dir[h] = 0;
else if (dj > 0)
dir[h] = 1;
else
dir[h] = 4;
}
}
return dir;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |