QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#329322#8217. King's Dinnerckiseki#RE 1ms3652kbC++203.5kb2024-02-16 16:03:292024-02-16 16:03:30

Judging History

你现在查看的是最新测评结果

  • [2024-02-16 16:03:30]
  • 评测
  • 测评结果:RE
  • 用时:1ms
  • 内存:3652kb
  • [2024-02-16 16:03:29]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;

#define all(x) begin(x), end(x)
#ifdef CKISEKI
#define safe cerr << __PRETTY_FUNCTION__ << " line " << __LINE__ << " safe\n"
#define debug(a...) debug_(#a, a)
#define orange(a...) orange_(#a, a)
#include <experimental/iterator>
void debug_(auto s, auto ...a) {
  cerr << "\e[1;32m(" << s << ") = (";
  int f = 0;
  (..., (cerr << (f++ ? ", " : "") << a));
  cerr << ")\e[0m\n";
}
void orange_(auto s, auto L, auto R) {
  cerr << "\e[1;33m[ " << s << " ] = [ ";
  using namespace experimental;
  copy(L, R, make_ostream_joiner(cerr, ", "));
  cerr << " ]\e[0m\n";
}
#else
#define safe ((void)0)
#define debug(...) safe
#define orange(...) safe
#endif

constexpr int N = 55;

int a[N][N];

void Do23(int x, int y, int v) {
  for (int i = 0; i < 2; ++i)
    for (int j = 0; j < 3; ++j)
      a[x + i][y + j] = v;
}
void Do32(int x, int y, int v) {
  for (int i = 0; i < 3; ++i)
    for (int j = 0; j < 2; ++j)
      a[x + i][y + j] = v;
}

int solve(int u, int d, int l, int r, int x) {
  if (r - l == d - u) {
    if (r - l == 1) {
      assert(false);
    } else if (r - l == 2) {
    } else if (r - l == 3) {
      Do32(u, l, x++);
    } else if (r - l == 4) {
      Do32(u, l, x++);
      Do32(u, l + 2, x++);
    } else if (r - l == 5) {
      Do32(u, l, x++);
      Do32(u + 2, l + 3, x++);
      Do23(u, l + 2, x++);
      Do23(u + 3, l, x++);
    } else if (r - l == 6) {
      Do32(u, l, x++);
      Do32(u, l + 2, x++);
      Do32(u, l + 4, x++);
      Do32(u + 3, l, x++);
      Do32(u + 3, l + 2, x++);
      Do32(u + 3, l + 4, x++);
    } else if (r - l == 7) {
      Do32(u, l, x++);
      Do32(u, l + 2, x++);
      Do23(u + 3, l, x++);
      Do23(u + 5, l, x++);
      Do23(u, l + 4, x++);
      Do23(u + 2, l + 4, x++);
      Do32(u + 4, l + 3, x++);
      Do32(u + 4, l + 5, x++);
    } else {
      x = solve(u, u + 6, l, l + 6, x);
      x = solve(u + 6, d, l + 6, r, x);
      x = solve(u, u + 6, l + 6, r, x);
      x = solve(u + 6, d, l, l + 6, x);
    }
  } else if (r - l == 6) {
    assert(d - u > 1);
    if ((d - u) % 2 == 1) {
      for (int i = u; i < d - 3; i += 2) {
        Do23(i, l, x++);
        Do23(i, l + 3, x++);
      }
      Do32(d - 3, l, x++);
      Do32(d - 3, l + 2, x++);
      Do32(d - 3, l + 4, x++);
    } else {
      for (int i = u; i < d; i += 2) {
        Do23(i, l, x++);
        Do23(i, l + 3, x++);
      }
    }
  } else if (d - u == 6) {
    assert(r - l > 1);
    if ((r - l)  % 2 == 1) {
      for (int i = l ; i < r - 3; i += 2) {
        Do32(u, i, x++);
        Do32(u + 3, i, x++);
      }
      Do23(u, r - 3, x++);
      Do23(u + 2, r - 3, x++);
      Do23(u + 4, r - 3, x++);
    } else {
      for (int i = l; i < r; i += 2) {
        Do32(u, i, x++);
        Do32(u + 3, i, x++);
      }
    }
  } else {
    assert(false);
  }
  return x;
}

int main() {
  cin.tie(nullptr)->sync_with_stdio(false);
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    for (int i = 0; i <= n; ++i)
      for (int j = 0; j <= n; ++j)
        a[i][j] = 0;
    solve(0, n + 1, 0, n + 1, 1);
    //for (int i = 0; i <= n; ++i)
    //  for (int j = 0; j <= n; ++j)
    //    cout << setw(2) << a[i][j] << " \n"[j == n];
    for (int i = 0; i < n; ++i) {
      for (int j = 0; j < n; ++j) {
        bool same = a[i][j] != 0;
        for (int dx = 0; dx < 2; ++dx) {
          for (int dy = 0; dy < 2; ++dy) {
            same &= a[i + dx][j + dy] == a[i][j];
          }
        }
        if (same)
          cout << "#";
        else
          cout << ".";
      }
      cout << '\n';
    }
  }
  return 0;
}

详细

Test #1:

score: 100
Accepted
time: 0ms
memory: 3612kb

input:

3
1
2
3

output:

.
#.
#.
#.#
#.#
...

result:

ok all tests correct (3 test cases)

Test #2:

score: 0
Accepted
time: 1ms
memory: 3652kb

input:

50
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50

output:

.
#.
#.
#.#
#.#
...
#.##
#...
...#
##.#
#.#.#
#.#.#
.....
#.#.#
#.#.#
#.#.##
#.#...
....##
##....
...#.#
##.#.#
#.#.#.#
#.#.#.#
.......
#.#.#.#
#.#.#.#
.......
##.##..
#.#.#.##
#.#.#...
......##
#.#.#...
#.#.#.##
........
#.#.#.#.
#.#.#.#.
#.#.#.#.#
#.#.#.#.#
.........
#.#.#.#.#
#.#.#.#.#
.........
...

result:

ok all tests correct (50 test cases)

Test #3:

score: -100
Runtime Error

input:

39
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89

output:

#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#
#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#
...................................................
#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#
#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#
...........................................

result: