QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#320351#8217. King's Dinnerucup-team1303#WA 1ms3600kbC++201.9kb2024-02-03 16:03:232024-02-03 16:03:24

Judging History

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

  • [2024-02-03 16:03:24]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3600kb
  • [2024-02-03 16:03:23]
  • 提交

answer

// MagicDark
#include <bits/stdc++.h>
#define debug cerr << "[" << __LINE__ << "] "
#define SZ(x) (int) x.size() - 1
#define all(x) x.begin(), x.end()
#define ms(x, y) memset(x, y, sizeof x)
#define F(i, x, y) for (int i = (x); i <= (y); i++)
#define DF(i, x, y) for (int i = (x); i >= (y); i--)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
template <typename T> inline void chkmax(T &x, T y) {x = max(x, y);}
template <typename T> inline void chkmin(T &x, T y) {x = min(x, y);}
template <typename T> inline void read(T &x) {
	x = 0; int f = 1; char c = getchar();
	for (; !isdigit(c); c = getchar()) if (c == '-') f = -f;
	for (; isdigit(c); c = getchar()) x = (x << 1) + (x << 3) + (c ^ 48);
	x *= f;
}
const int N = 110;
int n;
char a[N][N];
bool check1(int x, int y) {
	if (x == n) return false;
	F(i, max(1, x - 1), min(n, x + 2))
		F(j, max(1, y - 1), min(n, y + 1))
			if (a[i][j] == '#') return false;
	// if (a[x][y] == '#') return false;
	// if (a[x + 1][y] == '#') return false;
	// if (y > 1 && a[x - 1][y - 1] == '#') return false;
	// if (y > 1 && a[x][y - 1] == '#') return false;
	// if (y > 1 && a[x + 1][y - 1] == '#') return false;
	// if (y < n && a[x][y + 1] == '#') return false;
	// if (y < n && a[x + 1][y + 1] == '#') return false;
	return true;
}
bool check2(int x, int y) {
	if (y == n) return false;
	F(i, max(1, x - 1), min(n, x + 1))
		F(j, max(1, y - 1), min(n, y + 2))
			if (a[i][j] == '#') return false;
	return true;
}
void zhk() {
	cin >> n;
	F(i, 1, n)
		F(j, 1, n)
			a[i][j] = '.';
	F(i, 1, n) {
		F(j, 1, n) {
			if (check1(i, j)) {
				a[i][j] = a[i + 1][j] = '#';
			}
		}
	}
	F(i, 1, n) {
		F(j, 1, n) {
			if (check2(i, j)) {
				a[i][j] = a[i][j + 1] = '#';
			}
		}
	}
	F(i, 1, n) {
		F(j, 1, n)
			cout << a[i][j];
		cout << '\n';
	}
}
signed main() {
	int _ = 1;
	cin >> _;
	while (_--) zhk();
	return 0;
}
/* why?
*/

詳細信息

Test #1:

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

input:

3
1
2
3

output:

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

result:

ok all tests correct (3 test cases)

Test #2:

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

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 jury has the better answer: jans = 4, pans = 3 (test case 4)