QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#639763 | #8217. King's Dinner | Djangle162857 | AC ✓ | 2ms | 3732kb | C++23 | 2.9kb | 2024-10-13 22:17:07 | 2024-10-13 22:17:07 |
Judging History
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;
}
这程序好像有点Bug,我给组数据试试?
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3620kb
input:
3 1 2 3
output:
. #. #. #.# #.# ...
result:
ok all tests correct (3 test cases)
Test #2:
score: 0
Accepted
time: 1ms
memory: 3716kb
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: 3732kb
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: 3604kb
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: 0ms
memory: 3636kb
input:
1 100
output:
#.##.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.# #....#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.# ...#.................................................................................................
result:
ok all tests correct (1 test case)
Extra Test:
score: 0
Extra Test Passed