結果

問題 No.2212 One XOR Matrix
ユーザー tamatotamato
提出日時 2023-02-10 22:03:45
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 235 ms / 2,000 ms
コード長 1,005 bytes
コンパイル時間 301 ms
コンパイル使用メモリ 87,212 KB
実行使用メモリ 88,856 KB
最終ジャッジ日時 2023-09-21 23:19:14
合計ジャッジ時間 3,941 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 82 ms
71,232 KB
testcase_01 AC 81 ms
71,468 KB
testcase_02 AC 78 ms
71,352 KB
testcase_03 AC 80 ms
71,236 KB
testcase_04 AC 85 ms
75,416 KB
testcase_05 AC 95 ms
76,928 KB
testcase_06 AC 100 ms
77,024 KB
testcase_07 AC 111 ms
78,108 KB
testcase_08 AC 143 ms
79,868 KB
testcase_09 AC 235 ms
88,856 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

mod = 998244353


def main():
    import sys
    input = sys.stdin.readline

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

    NN = 2
    ans = [
        [7, 14, 0, 8],
        [4, 12, 2, 11],
        [15, 9, 6, 1],
        [13, 10, 5, 3]
    ]
    while NN < N:
        L = len(ans)
        LL = L * L
        ans_new = [[0] * (L * 2) for _ in range(L * 2)]
        for i in range(L):
            for j in range(L):
                ans_new[i][j] = ans[i][j]
                ans_new[i+L][j+L] = ans[i][j] + LL
                ans_new[i][j+L] = LL * 2 + i * L + j
                ans_new[i+L][j] = LL * 3 + i * L + j
        ans = ans_new
        NN += 1

    for line in ans:
        print(*line)

    L = len(ans)
    for i in range(L):
        x = 0
        for j in range(L):
            x ^= ans[i][j]
        assert x == 1
    for j in range(L):
        x = 0
        for i in range(L):
            x ^= ans[i][j]
        assert x == 1


if __name__ == '__main__':
    main()
0