답안 #533321

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
533321 2022-03-05T12:57:31 Z fhvirus Navigation 2 (JOI21_navigation2) C++17
0 / 100
2000 ms 2444 KB
#include "Anna.h"
#include <cmath>
#include <vector>
#include <iostream>

namespace {

const int kMark = 14;

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 10;
	if (j >= c + 2) return 11;
	if (i <= r - 2) return 12;
	if (i >= r + 2) return 13;
	int di = i - r, dj = j - c;
	return (di + 1) * 3 + (dj + 1) + 1;
}
void solve(const int& N, const int& K, const std::vector<int>& R, const std::vector<int>& C) {
	for (int i = 0; i < N; ++i)
		for (int j = 0; j < N; ++j) {
			int k = (i % 3) * 3 + (j % 3);
			flag[i][j] = (k < 7 ? get_val(i, j, R[k], C[k]) : (k == 8 ? kMark : 1));
		}
}

} // namespace

void Anna(int N, int K, std::vector<int> R, std::vector<int> C) {
	init(N);

	solve(N, K, R, C);

	for (int i = 0; i < N; ++i)
		for (int j = 0; j < N; ++j) {
			std::cerr << flag[i][j] << " \n"[j + 1 == N];
      SetFlag(i, j, flag[i][j]);
		}
	std::cerr << std::endl;
}
#include "Bruno.h"
#include <vector>
#include <iostream>

namespace {

const int kMark = 14;

int judge(const int& i, const int& j, const int& r, const int& c) {
	if (i == r and j == c) return 4;
	if (j < c) return 0;
	if (j > c) return 1;
	if (i < r) return 2;
	if (i > r) return 3;
	return -1;
}

} // namespace

std::vector<int> Bruno(int K, std::vector<int> value) {
	std::cerr << "Bruno:" << std::endl;
	int mark_i, mark_j;
	for (int i = 0; i < 9; ++i)
		if (value[i] == kMark) {
			mark_i = i / 3;
			mark_j = i % 3;
		}

	std::cerr << mark_i << ' ' << mark_j << std::endl;
	for (int i = 0; i < 3; ++i)
		for (int j = 0; j < 3; ++j)
			std::cerr << value[i * 3 + j] << " \n"[j == 2];
	std::cerr << std::endl;

	std::vector<int> res(K);
	for (int dk = 0; dk < 9; ++dk) {
		int i = (dk / 3 + 2 - mark_i) % 3, j = (dk % 3 + 2 - mark_j) % 3;
		int k = i * 3 + j;
		if (i * 3 + j >= 7) continue;
		std::cerr << dk << ':' << k;
		if (value[dk] >= 10) res[k] = value[dk] - 10;
		else {
			int r = dk / 3 + (1 - (value[dk] - 1) / 3);
			int c = dk % 3 + (1 - (value[dk] - 1) % 3);
			std::cerr << ' ' << r << ' ' << c;;
			res[k] = judge(1, 1, r, c);
		}
		std::cerr << std::endl;
	}

	for (int i = 0; i < K; ++i)
		std::cerr << res[i] << ' ';
	std::cerr << std::endl;

	return res;
}

Compilation message

Bruno.cpp: In function 'std::vector<int> Bruno(int, std::vector<int>)':
Bruno.cpp:37:54: warning: 'mark_j' may be used uninitialized in this function [-Wmaybe-uninitialized]
   37 |   int i = (dk / 3 + 2 - mark_i) % 3, j = (dk % 3 + 2 - mark_j) % 3;
      |                                          ~~~~~~~~~~~~^~~~~~~~~
Bruno.cpp:37:23: warning: 'mark_i' may be used uninitialized in this function [-Wmaybe-uninitialized]
   37 |   int i = (dk / 3 + 2 - mark_i) % 3, j = (dk % 3 + 2 - mark_j) % 3;
      |           ~~~~~~~~~~~~^~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Partially correct 90 ms 572 KB Partially correct
2 Partially correct 64 ms 584 KB Partially correct
3 Partially correct 76 ms 580 KB Partially correct
4 Partially correct 77 ms 572 KB Partially correct
5 Partially correct 101 ms 684 KB Partially correct
6 Partially correct 83 ms 580 KB Partially correct
7 Partially correct 109 ms 584 KB Partially correct
8 Partially correct 97 ms 684 KB Partially correct
9 Partially correct 89 ms 576 KB Partially correct
10 Partially correct 86 ms 584 KB Partially correct
11 Partially correct 104 ms 576 KB Partially correct
12 Partially correct 92 ms 584 KB Partially correct
13 Partially correct 106 ms 588 KB Partially correct
14 Partially correct 78 ms 580 KB Partially correct
15 Partially correct 104 ms 484 KB Partially correct
16 Partially correct 83 ms 500 KB Partially correct
17 Partially correct 91 ms 832 KB Partially correct
18 Partially correct 108 ms 708 KB Partially correct
19 Partially correct 99 ms 592 KB Partially correct
20 Partially correct 93 ms 600 KB Partially correct
21 Partially correct 91 ms 744 KB Partially correct
22 Partially correct 93 ms 700 KB Partially correct
23 Partially correct 87 ms 576 KB Partially correct
24 Partially correct 109 ms 584 KB Partially correct
25 Partially correct 89 ms 576 KB Partially correct
26 Partially correct 94 ms 704 KB Partially correct
27 Partially correct 102 ms 576 KB Partially correct
28 Partially correct 84 ms 584 KB Partially correct
29 Partially correct 89 ms 576 KB Partially correct
30 Partially correct 80 ms 736 KB Partially correct
31 Partially correct 109 ms 580 KB Partially correct
32 Partially correct 101 ms 488 KB Partially correct
33 Partially correct 93 ms 584 KB Partially correct
34 Partially correct 80 ms 708 KB Partially correct
35 Partially correct 100 ms 832 KB Partially correct
36 Partially correct 89 ms 592 KB Partially correct
37 Partially correct 102 ms 592 KB Partially correct
38 Partially correct 99 ms 596 KB Partially correct
39 Partially correct 110 ms 832 KB Partially correct
40 Partially correct 122 ms 584 KB Partially correct
41 Partially correct 119 ms 696 KB Partially correct
42 Partially correct 114 ms 572 KB Partially correct
43 Partially correct 125 ms 568 KB Partially correct
44 Partially correct 124 ms 728 KB Partially correct
45 Partially correct 112 ms 596 KB Partially correct
46 Partially correct 147 ms 832 KB Partially correct
47 Partially correct 132 ms 592 KB Partially correct
48 Partially correct 114 ms 604 KB Partially correct
49 Partially correct 149 ms 720 KB Partially correct
50 Partially correct 142 ms 592 KB Partially correct
51 Partially correct 121 ms 612 KB Partially correct
52 Partially correct 134 ms 600 KB Partially correct
53 Partially correct 126 ms 700 KB Partially correct
54 Partially correct 123 ms 732 KB Partially correct
55 Partially correct 139 ms 564 KB Partially correct
56 Partially correct 162 ms 596 KB Partially correct
57 Partially correct 188 ms 748 KB Partially correct
58 Partially correct 158 ms 636 KB Partially correct
59 Partially correct 181 ms 600 KB Partially correct
60 Partially correct 192 ms 960 KB Partially correct
61 Partially correct 162 ms 580 KB Partially correct
62 Partially correct 157 ms 576 KB Partially correct
63 Partially correct 185 ms 848 KB Partially correct
64 Partially correct 183 ms 572 KB Partially correct
65 Partially correct 167 ms 584 KB Partially correct
66 Partially correct 182 ms 836 KB Partially correct
67 Partially correct 202 ms 560 KB Partially correct
68 Partially correct 171 ms 604 KB Partially correct
69 Partially correct 169 ms 592 KB Partially correct
70 Partially correct 208 ms 600 KB Partially correct
71 Partially correct 169 ms 584 KB Partially correct
72 Partially correct 173 ms 608 KB Partially correct
73 Partially correct 203 ms 740 KB Partially correct
74 Partially correct 153 ms 584 KB Partially correct
75 Partially correct 191 ms 604 KB Partially correct
76 Partially correct 221 ms 872 KB Partially correct
77 Partially correct 197 ms 608 KB Partially correct
78 Partially correct 217 ms 588 KB Partially correct
79 Partially correct 156 ms 776 KB Partially correct
80 Partially correct 189 ms 692 KB Partially correct
81 Partially correct 179 ms 748 KB Partially correct
82 Partially correct 176 ms 632 KB Partially correct
83 Partially correct 156 ms 608 KB Partially correct
84 Partially correct 167 ms 756 KB Partially correct
85 Partially correct 201 ms 960 KB Partially correct
86 Partially correct 165 ms 488 KB Partially correct
87 Partially correct 185 ms 564 KB Partially correct
88 Partially correct 192 ms 904 KB Partially correct
89 Partially correct 171 ms 520 KB Partially correct
90 Partially correct 173 ms 604 KB Partially correct
91 Partially correct 219 ms 864 KB Partially correct
92 Partially correct 161 ms 624 KB Partially correct
93 Partially correct 167 ms 668 KB Partially correct
94 Partially correct 181 ms 912 KB Partially correct
95 Partially correct 166 ms 748 KB Partially correct
96 Partially correct 221 ms 572 KB Partially correct
97 Partially correct 163 ms 836 KB Partially correct
98 Partially correct 169 ms 576 KB Partially correct
99 Partially correct 158 ms 584 KB Partially correct
100 Partially correct 189 ms 828 KB Partially correct
101 Partially correct 177 ms 572 KB Partially correct
102 Partially correct 168 ms 568 KB Partially correct
103 Partially correct 223 ms 708 KB Partially correct
104 Partially correct 204 ms 572 KB Partially correct
105 Partially correct 190 ms 628 KB Partially correct
106 Partially correct 195 ms 984 KB Partially correct
107 Partially correct 179 ms 596 KB Partially correct
108 Partially correct 176 ms 612 KB Partially correct
109 Partially correct 163 ms 712 KB Partially correct
110 Partially correct 204 ms 716 KB Partially correct
111 Partially correct 164 ms 500 KB Partially correct
112 Partially correct 172 ms 888 KB Partially correct
113 Partially correct 183 ms 584 KB Partially correct
114 Partially correct 188 ms 576 KB Partially correct
115 Partially correct 164 ms 604 KB Partially correct
116 Partially correct 194 ms 768 KB Partially correct
117 Partially correct 165 ms 620 KB Partially correct
118 Partially correct 181 ms 640 KB Partially correct
119 Partially correct 192 ms 628 KB Partially correct
120 Execution timed out 2000 ms 2444 KB Time limit exceeded
121 Halted 0 ms 0 KB -