結果

問題 No.223 1マス指定の魔方陣
ユーザー keikei
提出日時 2018-09-24 16:45:51
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 3,315 bytes
コンパイル時間 136 ms
コンパイル使用メモリ 13,056 KB
実行使用メモリ 44,964 KB
最終ジャッジ日時 2024-09-22 06:51:08
合計ジャッジ時間 27,633 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 516 ms
44,584 KB
testcase_01 AC 514 ms
44,708 KB
testcase_02 AC 518 ms
44,956 KB
testcase_03 AC 508 ms
44,312 KB
testcase_04 AC 510 ms
44,700 KB
testcase_05 AC 512 ms
44,828 KB
testcase_06 AC 514 ms
44,452 KB
testcase_07 AC 509 ms
44,316 KB
testcase_08 AC 512 ms
44,320 KB
testcase_09 AC 508 ms
44,316 KB
testcase_10 AC 513 ms
44,712 KB
testcase_11 AC 511 ms
44,584 KB
testcase_12 AC 517 ms
44,324 KB
testcase_13 AC 510 ms
44,320 KB
testcase_14 AC 509 ms
44,448 KB
testcase_15 AC 515 ms
44,312 KB
testcase_16 AC 510 ms
44,312 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 AC 512 ms
44,696 KB
testcase_28 AC 511 ms
44,700 KB
testcase_29 AC 509 ms
44,688 KB
testcase_30 AC 515 ms
44,324 KB
testcase_31 AC 511 ms
44,328 KB
testcase_32 AC 509 ms
44,700 KB
testcase_33 AC 514 ms
44,700 KB
testcase_34 AC 517 ms
44,316 KB
testcase_35 AC 510 ms
44,580 KB
testcase_36 AC 514 ms
44,444 KB
testcase_37 AC 520 ms
44,700 KB
testcase_38 AC 516 ms
44,312 KB
testcase_39 AC 514 ms
44,568 KB
testcase_40 AC 510 ms
44,316 KB
testcase_41 AC 514 ms
44,316 KB
testcase_42 AC 510 ms
44,700 KB
testcase_43 AC 509 ms
44,568 KB
testcase_44 AC 515 ms
44,836 KB
testcase_45 AC 513 ms
44,680 KB
testcase_46 AC 517 ms
44,700 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

'''
    <url:https://yukicoder.me/problems/no/223>
    問題文============================================================
    =================================================================
    解説=============================================================
    
    ================================================================
    '''
import numpy as np
n,x,y,z = input().strip().split(' ')
n,x,y,z =[int(n),int(x),int(y),int(z)]
x-=1
y-=1
if n == 4:
    ans = np.array([
                    [1,14,4,15],
                    [8,11,5,10],
                    [13,2,16,3],
                    [12,7,9,6],
                    ])
elif n == 8:
    ans = np.array([
                    [12,34,63,17,44,50,31,1],
                    [55,25,4,42,23,9,36,58],
                    [0,46,51,29,32,62,19,13],
                    [59,21,8,38,27,5,40,54],
                    [28,2,47,49,60,18,15,33],
                    [39,57,20,10,7,41,52,26],
                    [16,14,35,61,48,30,3,45],
                    [43,53,24,6,11,37,56,22]
                    ])
else:
    ans = np.array([[  1, 248,  61, 204,  49, 200,  13, 252,  17, 232,  45, 220,  33,
                     216,  29, 236],
                    [255,  10, 195,  54, 207,  58, 243,   6, 239,  26, 211,  38, 223,
                     42, 227,  22],
                    [196,  53, 256,   9, 244,   5, 208,  57, 212,  37, 240,  25, 228,
                     21, 224,  41],
                    [ 62, 203,   2, 247,  14, 251,  50, 199,  46, 219,  18, 231,  30,
                     235,  34, 215],
                    [193,  56, 253,  12, 241,   8, 205,  60, 209,  40, 237,  28, 225,
                     24, 221,  44],
                    [ 63, 202,   3, 246,  15, 250,  51, 198,  47, 218,  19, 230,  31,
                     234,  35, 214],
                    [  4, 245,  64, 201,  52, 197,  16, 249,  20, 229,  48, 217,  36,
                     213,  32, 233],
                    [254,  11, 194,  55, 206,  59, 242,   7, 238,  27, 210,  39, 222,
                     43, 226,  23],
                    [ 65, 184, 125, 140, 113, 136,  77, 188,  81, 168, 109, 156,  97,
                     152,  93, 172],
                    [191,  74, 131, 118, 143, 122, 179,  70, 175,  90, 147, 102, 159,
                     106, 163,  86],
                    [132, 117, 192,  73, 180,  69, 144, 121, 148, 101, 176,  89, 164,
                     85, 160, 105],
                    [126, 139,  66, 183,  78, 187, 114, 135, 110, 155,  82, 167,  94,
                     171,  98, 151],
                    [129, 120, 189,  76, 177,  72, 141, 124, 145, 104, 173,  92, 161,
                     88, 157, 108],
                    [127, 138,  67, 182,  79, 186, 115, 134, 111, 154,  83, 166,  95,
                     170,  99, 150],
                    [ 68, 181, 128, 137, 116, 133,  80, 185,  84, 165, 112, 153, 100,
                     149,  96, 169],
                    [190,  75, 130, 119, 142, 123, 178,  71, 174,  91, 146, 103, 158,
                     107, 162,  87]])

kx,ky = np.where(ans==z)
kx = int(kx)
ky = int(ky)
kx += n - y
ky += n - x
ans = np.concatenate([ans,ans,ans])
ans = np.concatenate([ans,ans,ans],axis=1)
ans = ans[kx:kx+n,ky:ky+n]

#print(ans)
for i in range(n):
    for j in range(n):
        print(ans[i][j],end=" ")
    print("")
0