QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#741176#8217. King's Dinnerucup-team3646WA 1ms3616kbC++201.5kb2024-11-13 13:41:122024-11-13 13:41:14

Judging History

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

  • [2024-11-13 13:41:14]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3616kb
  • [2024-11-13 13:41:12]
  • 提交

answer

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

using ll = long long;
#define rep(i, n) for (ll i = 0; i < n; i++)
#define rep2(i, l, r) for (ll i = l; i < r; i++)

using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;

/* ---- */
#define all(A) A.begin(), A.end()
#define elif else if
using pii = pair<ll, ll>;

bool chmin(auto &a, const auto &b) { return a > b ? a = b, 1 : 0; }
bool chmax(auto &a, const auto &b) { return a < b ? a = b, 1 : 0; }

struct IOSetup
{
  IOSetup()
  {
    cin.tie(0);
    ios::sync_with_stdio(0);
  }
} iosetup;

template <class T>
void print(vector<T> a)
{
  for (auto x : a)
    cerr << x << ' ';
  cerr << endl;
}

void print(auto x) { cerr << x << endl; }

template <class Head, class... Tail>
void print(Head &&head, Tail &&...tail)
{
  cerr << head << ' ';
  print(forward<Tail>(tail)...);
}

void solve()
{
  int n;
  cin >> n;
  if (n == 1)
  {
    cout << ".\n";
    return;
  }
  vector<string> S(n, string(n, '.'));
  if (n % 2 == 0)
  {
    rep(i, n) rep(j, n)
    {
      if ((((i / 2) ^ j) & 1) == 0)
        S[i][j] = '#';
    }
    rep(i, n) cout << S[i] << '\n';
    return;
  }
  rep(i, n - 3) rep(j, n)
  {
    if ((((i / 2) ^ j) & 1) == 0)
      S[i][j] = '#';
  }

  for (int j = 0; j < n; j += 2)
  {
    S[n - 2][j] = '#';
    S[n - 1][j] = '#';
  }
  rep(i, n)
  {
    cout << S[i] << '\n';
  }
}

int main()
{
  int T;
  cin >> T;
  rep(i, T) solve();
}

详细

Test #1:

score: 100
Accepted
time: 1ms
memory: 3616kb

input:

3
1
2
3

output:

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

result:

ok all tests correct (3 test cases)

Test #2:

score: -100
Wrong Answer
time: 1ms
memory: 3532kb

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:

wrong answer grid contains two dominoes that are adjacent (test case 4)