Contest Duration: - (local time) (150 minutes) Back to Home

Submission #9184268

Source Code Expand

Copy
```import sys

import numpy as np

def output(A):
print('\n'.join(''.join(row) for row in A))

a = 'a'; b = 'b'; c = 'c'; d = 'd'; e = 'e'; f = 'f'; g = 'g'; h = 'h'; x = '.'

A3 = np.array([
[a,a,x],
[x,x,a],
[x,x,a]
],dtype='U1')

A4 = np.array([
[a,a,c,d],
[b,b,c,d],
[e,f,g,g],
[e,f,h,h]
],dtype='U1')

A5 = np.array([
[a,a,c,a,a],
[b,b,c,x,c],
[x,a,b,b,c],
[b,a,x,x,a],
[b,x,b,b,a]
],dtype='U1')

A7 = np.array([
[a,b,a,x,x,x,x],
[a,b,a,x,x,x,x],
[c,c,b,a,a,x,x],
[x,a,b,c,c,x,x],
[x,a,x,x,a,b,b],
[a,x,x,x,a,c,c],
[a,x,b,b,x,a,a],
],dtype='U1')

def solve(N):
if N <= 2:
print(-1)
return
if N == 3:
output(A3)
return
if N == 6:
A = np.full((6,6),'.','U1')
A[:3,:3] = A3
A[3:,3:] = A3
output(A)
return
if N == 7:
output(A7)
return
if N == 11:
A = np.full((11,11),'.','U1')
A[:4,:4] = A4
A[4:,4:] = A7
output(A)
return
# 4,5,8,9,10,12以上
# このときは、4x+5yと書ける
x = 0
while (N - 4 * x) % 5:
x += 1
y = (N - 4 * x) // 5
A = np.full((N,N),'.','U1')
for i in range(x):
A[4*i:4*i+4,4*i:4*i+4] = A4
for j in range(y):
A[4*x+5*j:4*x+5*j+5,4*x+5*j:4*x+5*j+5] = A5
output(A)
return

solve(N)```

#### Submission Info

Submission Time 2019-12-28 22:12:09+0900 C - Domino Quality maspy Python (3.4.3) 900 1608 Byte AC 428 ms 21144 KB

#### Judge Result

Set Name Sample All
Score / Max Score 0 / 0 900 / 900
Status
 AC × 2
 AC × 59
Set Name Test Cases
Sample 00-sample-01.txt, 00-sample-02.txt
All 00-sample-01.txt, 00-sample-02.txt, 01-01.txt, 01-02.txt, 01-03.txt, 01-04.txt, 01-05.txt, 01-06.txt, 01-07.txt, 01-08.txt, 01-09.txt, 01-10.txt, 01-11.txt, 01-12.txt, 01-13.txt, 01-14.txt, 01-15.txt, 01-16.txt, 01-17.txt, 01-18.txt, 01-19.txt, 01-20.txt, 01-21.txt, 01-22.txt, 01-23.txt, 01-24.txt, 01-25.txt, 01-26.txt, 01-27.txt, 01-28.txt, 01-29.txt, 01-30.txt, 01-31.txt, 01-32.txt, 01-33.txt, 01-34.txt, 01-35.txt, 01-36.txt, 01-37.txt, 01-38.txt, 01-39.txt, 01-40.txt, 01-41.txt, 01-42.txt, 01-43.txt, 01-44.txt, 01-45.txt, 01-46.txt, 01-47.txt, 01-48.txt, 01-49.txt, 01-50.txt, 01-51.txt, 01-52.txt, 01-53.txt, 01-54.txt, 01-55.txt, 01-56.txt, 01-57.txt
Case Name Status Exec Time Memory
00-sample-01.txt AC 288 ms 21144 KB
00-sample-02.txt AC 147 ms 12500 KB
01-01.txt AC 146 ms 12500 KB
01-02.txt AC 151 ms 12500 KB
01-03.txt AC 146 ms 12500 KB
01-04.txt AC 148 ms 12500 KB
01-05.txt AC 148 ms 12500 KB
01-06.txt AC 147 ms 12500 KB
01-07.txt AC 147 ms 12500 KB
01-08.txt AC 147 ms 12500 KB
01-09.txt AC 146 ms 12500 KB
01-10.txt AC 149 ms 12500 KB
01-11.txt AC 148 ms 12500 KB
01-12.txt AC 148 ms 14500 KB
01-13.txt AC 147 ms 12452 KB
01-14.txt AC 147 ms 12500 KB
01-15.txt AC 147 ms 12500 KB
01-16.txt AC 148 ms 12500 KB
01-17.txt AC 147 ms 12500 KB
01-18.txt AC 147 ms 12500 KB
01-19.txt AC 146 ms 12500 KB
01-20.txt AC 168 ms 12948 KB
01-21.txt AC 151 ms 12500 KB
01-22.txt AC 146 ms 12500 KB
01-23.txt AC 177 ms 13252 KB
01-24.txt AC 203 ms 13844 KB
01-25.txt AC 199 ms 13764 KB
01-26.txt AC 211 ms 13892 KB
01-27.txt AC 186 ms 13380 KB
01-28.txt AC 150 ms 12500 KB
01-29.txt AC 168 ms 12948 KB
01-30.txt AC 251 ms 15276 KB
01-31.txt AC 276 ms 16164 KB
01-32.txt AC 245 ms 15036 KB
01-33.txt AC 290 ms 16280 KB
01-34.txt AC 262 ms 15660 KB
01-35.txt AC 312 ms 16860 KB
01-36.txt AC 328 ms 17008 KB
01-37.txt AC 208 ms 14020 KB
01-38.txt AC 370 ms 18144 KB
01-39.txt AC 317 ms 16916 KB
01-40.txt AC 330 ms 17460 KB
01-41.txt AC 296 ms 16480 KB
01-42.txt AC 404 ms 19460 KB
01-43.txt AC 248 ms 15160 KB
01-44.txt AC 366 ms 18436 KB
01-45.txt AC 407 ms 19456 KB
01-46.txt AC 408 ms 19400 KB
01-47.txt AC 405 ms 19412 KB
01-48.txt AC 428 ms 19528 KB
01-49.txt AC 405 ms 19528 KB
01-50.txt AC 409 ms 19528 KB
01-51.txt AC 406 ms 19528 KB
01-52.txt AC 406 ms 19404 KB
01-53.txt AC 400 ms 19404 KB
01-54.txt AC 411 ms 19684 KB
01-55.txt AC 413 ms 19576 KB
01-56.txt AC 407 ms 19576 KB
01-57.txt AC 411 ms 19524 KB