結果

問題 No.2212 One XOR Matrix
ユーザー aaaaaaaaaa2230aaaaaaaaaa2230
提出日時 2023-02-10 23:21:14
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 702 bytes
コンパイル時間 329 ms
コンパイル使用メモリ 87,212 KB
実行使用メモリ 86,916 KB
最終ジャッジ日時 2023-09-22 00:24:10
合計ジャッジ時間 4,363 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 73 ms
71,204 KB
testcase_01 AC 73 ms
71,240 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
if n == 1:
    print(-1)
    exit()

base = [[7,14,0,8],
        [4,12,2,11],
        [15,9,6,1],
        [13,10,5,3]]

if n == 2:
    ans = base
else:

    ans = [[0]*(1<<n) for i in range(1<<n)]

    last = 0
    size = (1<<n)//4
    for i in range(size):
        for j in range(size):
            x = i*4
            y = j*4
            if i != j:    
                for a in range(4):
                    for b in range(4):
                        ans[x+a][y+b] = last+a*4+b
                last += 16
            else:
                for a in range(4):
                    for b in range(4):
                        ans[x+a][y+b] = last+base[a][b]

for i in ans:
    print(*i)

0