File tree Expand file tree Collapse file tree 2 files changed +6
-10
lines changed
library/data_structures/uncommon
tests/library_checker_aizu_tests/handmade_tests Expand file tree Collapse file tree 2 files changed +6
-10
lines changed Original file line number Diff line number Diff line change 1010// ! @space O(1)
1111ll hilbert (int x, int y) {
1212 ll d = 0 , mx = 1 ;
13- while (mx <= max (x, y)) mx *= 4 ;
13+ while (mx <= max (x, y)) mx *= 4 ;
1414 for (int s = mx / 2 ; s; s /= 2 ) {
1515 bool rx = x & s, ry = y & s;
1616 d = d * 4 | (ry * 3 ^ rx);
Original file line number Diff line number Diff line change @@ -12,27 +12,23 @@ void test(int i, int j) {
1212 for (int k = 0 ; k < 4 ; k++) {
1313 int to_i = i + di[k];
1414 int to_j = j + dj[k];
15- if (to_i >= 0 && to_j >= 0 ) {
15+ if (to_i >= 0 && to_j >= 0 ) {
1616 cnt_prev += (res - 1 == hilbert (to_i, to_j));
1717 cnt_next += (res + 1 == hilbert (to_i, to_j));
1818 }
1919 }
20- if (i== 0 && j== 0 ) assert (res == 0 );
20+ if (i == 0 && j == 0 ) assert (res == 0 );
2121 else assert (cnt_prev == 1 );
2222 assert (cnt_next == 1 );
2323}
24-
2524int main () {
2625 cin.tie (0 )->sync_with_stdio (0 );
27- for (int i = 0 ; i < 3000 ; i++) {
28- for (int j = 0 ; j < 3000 ; j++) {
29- test (i,j);
30- }
31- }
26+ for (int i = 0 ; i < 3000 ; i++)
27+ for (int j = 0 ; j < 3000 ; j++) test (i, j);
3228 for (int iter = 50000 ; iter--;) {
3329 int i = rnd (0 , 1'000'000'000 );
3430 int j = rnd (0 , 1'000'000'000 );
35- test (i,j);
31+ test (i, j);
3632 }
3733 cout << " Hello World\n " ;
3834}
You can’t perform that action at this time.
0 commit comments