結果

問題 No.2212 One XOR Matrix
ユーザー minimumminimum
提出日時 2023-02-10 22:49:20
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 957 bytes
コンパイル時間 470 ms
コンパイル使用メモリ 87,092 KB
実行使用メモリ 86,592 KB
最終ジャッジ日時 2023-09-21 23:58:33
合計ジャッジ時間 3,971 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 73 ms
71,504 KB
testcase_02 AC 73 ms
71,188 KB
testcase_03 AC 80 ms
71,592 KB
testcase_04 AC 79 ms
75,084 KB
testcase_05 AC 93 ms
76,812 KB
testcase_06 AC 102 ms
77,356 KB
testcase_07 AC 113 ms
77,864 KB
testcase_08 AC 138 ms
80,088 KB
testcase_09 AC 241 ms
86,592 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

A = [[0] * (1 << N) for _ in range(1 << N)]
for i in range(1 << (2 * N - 2)):
    r = i // (1 << (N - 1))
    c = i % (1 << (N - 1))
    A[r][c] = i
    A[(1 << N) - 1 - c][r] = i
    A[c][(1 << N) - 1 - r] = i
    A[r + (1 << (N - 1))][c + (1 << (N - 1))] = i

for i in range(1 << N):
    for j in range(1 << N):
        A[i][j] <<= 1
        if i < (1 << (N - 1)):
            A[i][j] += 1
        A[i][j] <<= 1

for i in range(1 << N):
    for j in range(1 << N):
        if i < (1 << (N - 1)) and j < (1 << (N - 1)):
            if i == 0:
                A[i][j] += 1
        elif i < (1 << (N - 1)) and j >= (1 << (N - 1)):
            if j != ((1 << N) - 1):
                A[i][j] += 1
        elif i >= (1 << (N - 1)) and j < (1 << (N - 1)):
            if j != 0:
                A[i][j] += 1
        else:
            if i == 1 << (N - 1):
                A[i][j] += 1

for a in A:
    print(*a)
0