結果
問題 | No.2212 One XOR Matrix |
ユーザー | LyricalMaestro |
提出日時 | 2024-01-26 03:31:19 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 123 ms / 2,000 ms |
コード長 | 1,070 bytes |
コンパイル時間 | 411 ms |
コンパイル使用メモリ | 81,572 KB |
実行使用メモリ | 83,852 KB |
最終ジャッジ日時 | 2024-01-26 03:31:23 |
合計ジャッジ時間 | 3,769 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge14 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 36 ms
53,460 KB |
testcase_01 | AC | 36 ms
53,460 KB |
testcase_02 | AC | 36 ms
53,460 KB |
testcase_03 | AC | 37 ms
53,460 KB |
testcase_04 | AC | 49 ms
59,452 KB |
testcase_05 | AC | 42 ms
59,752 KB |
testcase_06 | AC | 44 ms
61,824 KB |
testcase_07 | AC | 51 ms
66,324 KB |
testcase_08 | AC | 71 ms
77,588 KB |
testcase_09 | AC | 123 ms
83,852 KB |
ソースコード
## https://yukicoder.me/problems/no/2212 def main(): N = int(input()) if N == 1: print(-1) return matrix = [[0] * (2 ** N) for _ in range(2 ** N)] for i in range(2 ** N): for j in range(2 ** N): x = (i << N) + j matrix[i][j] = x for i in range(0, 2 ** N, 2): j = i tmp = matrix[i][j + 1] matrix[i][j + 1] = matrix[i][j] matrix[i][j] = tmp if j % 4 == 0: tmp = matrix[i][j] matrix[i][j] = matrix[i + 1][j] matrix[i + 1][j] = tmp tmp = matrix[i][j + 2] matrix[i][j + 2] = matrix[i + 1][j + 2] matrix[i + 1][j + 2] = tmp else: tmp = matrix[i][j] matrix[i][j] = matrix[i + 1][j] matrix[i + 1][j] = tmp tmp = matrix[i][j - 2] matrix[i][j - 2] = matrix[i + 1][j - 2] matrix[i + 1][j - 2] = tmp for i in range(2 ** N): print(" ".join(map(str, matrix[i]))) if __name__ == "__main__": main()