|
| 1 | +#define PROBLEM \ |
| 2 | + "https://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ITP1_1_A" |
| 3 | +#include "../template.hpp" |
| 4 | +#include "../../../library/contest/random.hpp" |
| 5 | +#include "../../../library/data_structures/uncommon/hilbert_mos.hpp" |
| 6 | +const vector<int> di = {1, -1, 0, 0}; |
| 7 | +const vector<int> dj = {0, 0, 1, -1}; |
| 8 | +void test(int i, int j) { |
| 9 | + ll res = hilbert(i, j); |
| 10 | + int cnt_prev = 0; |
| 11 | + int cnt_next = 0; |
| 12 | + for (int k = 0; k < 4; k++) { |
| 13 | + int to_i = i + di[k]; |
| 14 | + int to_j = j + dj[k]; |
| 15 | + if (to_i >= 0 && to_j >= 0) { |
| 16 | + cnt_prev += (res - 1 == hilbert(to_i, to_j)); |
| 17 | + cnt_next += (res + 1 == hilbert(to_i, to_j)); |
| 18 | + } |
| 19 | + } |
| 20 | + if (i == 0 && j == 0) assert(res == 0); |
| 21 | + else assert(cnt_prev == 1); |
| 22 | + assert(cnt_next == 1); |
| 23 | +} |
| 24 | +int main() { |
| 25 | + cin.tie(0)->sync_with_stdio(0); |
| 26 | + for (int i = 0; i < 3000; i++) |
| 27 | + for (int j = 0; j < 3000; j++) test(i, j); |
| 28 | + for (int iter = 50000; iter--;) { |
| 29 | + int i = rnd(0, 1'000'000'000); |
| 30 | + int j = rnd(0, 1'000'000'000); |
| 31 | + test(i, j); |
| 32 | + } |
| 33 | + cout << "Hello World\n"; |
| 34 | +} |
0 commit comments