Submission #666815

# Submission time Handle Problem Language Result Execution time Memory
666815 2022-11-29T18:47:20 Z rainboy Navigation 2 (JOI21_navigation2) C++17
0 / 100
0 ms 200 KB
#include "Anna.h"
#include <vector>

using namespace std;

typedef vector<int> vi;

namespace {}

void Anna(int n, int k, vi ii, vi jj) {
	k += k; //TODO
	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 = h / 3, j = h % 3, a = B::aa[(i_ + i) % 3][(j_ + j) % 3];
		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
1 Incorrect 0 ms 200 KB Wrong Answer [7]
2 Halted 0 ms 0 KB -