QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#543287#8217. King's DinnerchanmaoAC ✓2ms3640kbC++143.3kb2024-09-01 15:37:592024-09-01 15:38:00

Judging History

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

  • [2024-09-01 15:38:00]
  • 评测
  • 测评结果:AC
  • 用时:2ms
  • 内存:3640kb
  • [2024-09-01 15:37:59]
  • 提交

answer

#include <iostream>
using namespace std;

char mp[8][8][8];
char G[105][105];

string _1[2] = { "",
				 " ." };
string _2[3] = { "",
				 " ..",
				 " .." };
string _3[4] = { "",
				 " #..",
				 " #..",
				 " ..." };
string _4[5] = { "",
				 " #.#.",
				 " #.#.",
				 " ....",
				 " ...." };
string _5[6] = { "",
				 " ##.#.",
				 " ...#.",
				 " #....",
				 " #.##.",
				 " ....." };
string _6[7] = { "",
				 " ##.##.",
				 " ......",
				 " ##.##.",
				 " ......",
				 " ##.##.",
				 " ......" };
string _7[8] = { "",
				 " ##.#.#.",
				 " ...#.#.",
				 " ##.....",
				 " ....##.",
				 " #.#....",
				 " #.#.##.",
				 " ......." };
	

inline void init() {
	int len = 1;
	len = 1; for (int i = 1; i <= len; i++)  for (int j = 1; j <= len; j++)  { mp[len][i][j] = _1[i][j]; }
	len = 2; for (int i = 1; i <= len; i++)  for (int j = 1; j <= len; j++)  { mp[len][i][j] = _2[i][j]; }
	len = 3; for (int i = 1; i <= len; i++)  for (int j = 1; j <= len; j++)  { mp[len][i][j] = _3[i][j]; }
	len = 4; for (int i = 1; i <= len; i++)  for (int j = 1; j <= len; j++)  { mp[len][i][j] = _4[i][j]; }
	len = 5; for (int i = 1; i <= len; i++)  for (int j = 1; j <= len; j++)  { mp[len][i][j] = _5[i][j]; }
	len = 6; for (int i = 1; i <= len; i++)  for (int j = 1; j <= len; j++)  { mp[len][i][j] = _6[i][j]; }
	len = 7; for (int i = 1; i <= len; i++)  for (int j = 1; j <= len; j++)  { mp[len][i][j] = _7[i][j]; }
}

inline void fil(int i, int j, bool d) {
//	cout << i << " " << j << " " << d << endl;
	if (d) {
		G[i][j] = '#'; G[i][j + 1] = '#'; G[i][j + 2] = '.';
		G[i + 1][j] = '.'; G[i + 1][j + 1] = '.'; G[i + 1][j + 2] = '.';
	} else {
		G[i][j] = '#'; G[i][j + 1] = '.';
		G[i + 1][j] = '#'; G[i + 1][j + 1] = '.';
		G[i + 2][j] = '.'; G[i + 2][j + 1] = '.';
	}
//	G[i][j] = d + '0';
}

inline void solve() {
	int n;
	cin >> n; n++;
	if (n <= 7) {
		for (int i = 1; i < n; i++) {
			for (int j = 1; j < n; j++) {
				cout << mp[n][i][j];
			}
			cout << "\n";
		}
		return;
	}
	int cur = n % 6;
	if (cur <= 1) cur += 6;
	for (int i = 1; i <= cur; i++) {
		for (int j = 1; j <= cur; j++) {
			G[i][j] = mp[cur][i][j];
		}
	}
	while (cur < n) {
//		cout << cur << endl;
		for (int i = 1; i + 4 - 1 <= cur; i += 4) {
//			cout << i;
			fil(i, cur + 1, 1); fil(i, cur + 1 + 3, 1);
			fil(i + 2, cur + 1, 1); fil(i + 2, cur + 1 + 3, 1);
			fil(cur + 1, i, 0); fil(cur + 1 + 3, i, 0);
			fil(cur + 1, i + 2, 0); fil(cur + 1 + 3, i + 2, 0);
		}
		if (cur % 2) {
			fil(cur - 2, cur + 1, 0); fil(cur - 2, cur + 3, 0); fil(cur - 2, cur + 5, 0);
			fil(cur + 1, cur - 2, 1); fil(cur + 3, cur - 2, 1); fil(cur + 5, cur - 2, 1);
		} else {
			fil(cur - 1, cur + 1, 1); fil(cur - 1, cur + 4, 1);
			fil(cur + 1, cur - 1, 0); fil(cur + 4, cur - 1, 0);
		}
		for (int i = 1; i <= 6; i++) {
			for (int j = 1; j <= 6; j++) {
				G[cur + i][cur + j] = mp[6][i][j];
			}
		}
		cur += 6;
	}
	for (int i = 1; i < n; i++) {
		for (int j = 1; j < n; j++) {
			cout << G[i][j];
		}
		cout << "\n";
	}
}

int main() {
	ios::sync_with_stdio(false);
	cin.tie();
	cout.tie();
//	fil(1, 1, 1) ;
//	for (int i = 1; i <= 3; i++) {
//		for (int j = 1; j <= 3; j++) {
//			cout << G[i][j];
//		}
//		cout << "\n";
//	}
	init();
	int t;
	cin >> t;
	while (t--) {
		solve();
	}
}

这程序好像有点Bug,我给组数据试试?

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

3
1
2
3

output:

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

result:

ok all tests correct (3 test cases)

Test #2:

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

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: 0
Accepted
time: 2ms
memory: 3640kb

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:

ok all tests correct (39 test cases)

Test #4:

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

input:

11
90
91
92
93
94
95
96
97
98
99
100

output:

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

result:

ok all tests correct (11 test cases)

Test #5:

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

input:

1
100

output:

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

result:

ok all tests correct (1 test case)

Extra Test:

score: 0
Extra Test Passed