QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#724390 | #8217. King's Dinner | tassei903# | AC ✓ | 33ms | 11096kb | Python3 | 1.7kb | 2024-11-08 12:55:23 | 2024-11-08 12:55:23 |
Judging History
answer
import sys
input = lambda :sys.stdin.readline()[:-1]
ni = lambda :int(input())
na = lambda :list(map(int,input().split()))
yes = lambda :print("yes");Yes = lambda :print("Yes");YES = lambda : print("YES")
no = lambda :print("no");No = lambda :print("No");NO = lambda : print("NO")
#######################################################################
def solve(n):
if n == 1:
return [["."]]
elif n == 2:
return [["#", "#"], [".", "."]]
elif n == 3:
return [list("#.#"), list("#.#"), list("...")]
elif n == 4:
return [list("##.#"), list("...#"), list("#..."), list("#.##")]
elif n == 5:
return [list("##.##"), list("....."), list("##.##"), list("....."), list("##.##")]
elif n == 6:
return [list("##.#.#"), list("...#.#"), list("##...."), list("....##"), list("#.#..."), list("#.#.##")]
a = solve(n - 6)
b = [["."] * n for i in range(n)]
for i in range(n-6):
for j in range(n-6):
b[i][j] = a[i][j]
if n % 2:
for j in range(0, n, 2):
b[-1][j] = b[-2][j] = b[-4][j] = b[-5][j] = "#"
for i in range(0, n - 6, 2):
b[i][-1] = b[i][-2] = b[i][-4] = b[i][-5] = "#"
else:
b[-1][0] = b[-1][1] = b[-3][0] = b[-3][1] = b[-5][0] = b[-5][1] = "#"
for j in range(3, n, 2):
b[-1][j] = b[-2][j] = b[-4][j] = b[-5][j] = "#"
b[0][-1] = b[1][-1] = b[0][-3] = b[1][-3] = b[0][-5] = b[1][-5] = "#"
for i in range(3, n - 6, 2):
b[i][-1] = b[i][-2] = b[i][-4] = b[i][-5] = "#"
return b
for _ in range(ni()):
n = ni()
a = solve(n)
for i in a:
print("".join(i))
# print()
这程序好像有点Bug,我给组数据试试?
詳細信息
Test #1:
score: 100
Accepted
time: 11ms
memory: 10532kb
input:
3 1 2 3
output:
. ## .. #.# #.# ...
result:
ok all tests correct (3 test cases)
Test #2:
score: 0
Accepted
time: 11ms
memory: 10872kb
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: 33ms
memory: 11068kb
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: 29ms
memory: 11096kb
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: 16ms
memory: 10868kb
input:
1 100
output:
##.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.# ...#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.# #....................................................................................................
result:
ok all tests correct (1 test case)
Extra Test:
score: 0
Extra Test Passed