QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#639759#8217. King's DinnerDjangle162857WA 1ms3660kbC++232.9kb2024-10-13 22:15:342024-10-13 22:15:34

Judging History

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

  • [2024-10-13 22:15:34]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3660kb
  • [2024-10-13 22:15:34]
  • 提交

answer

#define LOCAL
#include <bits/stdc++.h>
#define fir first
#define sec second
#define el '\n'

#ifdef LOCAL
#define FINISH cerr << "FINISH" << endl;
#else
#define FINISH ;
#endif

#ifdef LOCAL
#define debug(x) cerr << setw(4) << #x << " == " << x << endl
#else
#define debug(x)
#endif

#ifdef LOCAL
#define debugv(x)                   \
	cerr << setw(4) << #x << ":: "; \
	for (auto i : x)                \
		cerr << i << " ";           \
	cerr << endl
#else
#define debugv(x)
#endif

using namespace std;
typedef long long ll;
typedef pair<int, int> PII;
ostream& operator<<(ostream& out, PII& x)
{
	out << x.fir << " " << x.sec << endl;
	return out;
}

const int mod = 998244353;
const int inf = 0x3f3f3f3f;
const int N = 200020;
char a[220][220];
string s[10][10];
void getans(int x)
{
	if (x <= 7) {
		for (int i = 1; i <= x; i++) {
			for (int j = 1; j <= x; j++) {
				a[i][j] = s[x][i][j];
			}
		}
		return;
	}
	if (x % 2 == 1) {
		for (int i = x - 5; i <= x; i++) {
			for (int j = 1; j <= x - 5; j++) {
				if (i == x - 5 || i == x - 2) {
					a[i][j] = '.';
				}
				else {
					a[i][j] = '.';
					if (j % 2 == 1)
						a[i][j] = '#';
				}
			}
		}
	}
	else {
		for (int i = x - 5; i <= x; i++) {
			for (int j = 1; j <= 3; j++) {
				a[i][j] = '.';
			}
		}
		for (int i = x - 4; i <= x; i += 2) {
			for (int j = 1; j <= 2; j++) {
				a[i][j] = '#';
			}
		}
		for (int i = x - 5; i <= x; i++) {
			for (int j = 4; j <= x - 5; j++) {
				if (i == x - 5 || i == x - 2) {
					a[i][j] = '.';
				}
				else {
					a[i][j] = '.';
					if (j % 2 == 0)
						a[i][j] = '#';
				}
			}
		}
	}
	for (int i = x - 4; i <= x; i++) {
		for (int j = x - 4; j <= x; j++) {
			int resi = i - (x - 5);
			int resj = j - (x - 5);
			a[i][j] = s[5][resi][resj];
		}
	}
	for (int i = 1; i <= x - 5; i++) {
		for (int j = x - 5; j <= x; j++) {
			a[i][j] = a[j][i];
		}
	}
	getans(x - 6);
}
void solve()
{
	int n;
	cin >> n;
	getans(n);
	for (int i = 1; i <= n; i++) {
		for (int j = 1; j <= n; j++) {
			cout << a[i][j];
		}
		cout << el;
	}
	cout << endl;
}
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);
	int T = 1;
	cin >> T;
	s[1][1] = " .";

	s[2][1] = " #.";
	s[2][2] = " #.";

	s[3][1] = " #.#";
	s[3][2] = " #.#";
	s[3][3] = " ...";

	s[4][1] = " ..##";
	s[4][2] = " #...";
	s[4][3] = " #.##";
	s[4][4] = " ....";

	s[5][1] = " ##.##";
	s[5][2] = " .....";
	s[5][3] = " ##.##";
	s[5][4] = " .....";
	s[5][5] = " ##.##";

	s[6][1] = " #.#.##";
	s[6][2] = " #.#...";
	s[6][3] = " ....##";
	s[6][4] = " ##....";
	s[6][5] = " ...#.#";
	s[6][6] = " ##.#.#";

	s[7][1] = " #.#.#.#";
	s[7][2] = " #.#.#.#";
	s[7][3] = " .......";
	s[7][4] = " #.#.#.#";
	s[7][5] = " #.#.#.#";
	s[7][6] = " .......";
	s[7][7] = " ##.##..";
	while (T--) {
		solve();
	}
	return 0;
}

詳細信息

Test #1:

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

input:

3
1
2
3

output:

.

#.
#.

#.#
#.#
...


result:

ok all tests correct (3 test cases)

Test #2:

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

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)