結果

問題 No.2442 線形写像
ユーザー FromBooskaFromBooska
提出日時 2023-08-25 22:59:18
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 539 ms / 2,000 ms
コード長 1,162 bytes
コンパイル時間 247 ms
コンパイル使用メモリ 86,964 KB
実行使用メモリ 90,508 KB
最終ジャッジ日時 2023-08-26 12:18:50
合計ジャッジ時間 5,656 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 77 ms
72,140 KB
testcase_01 AC 65 ms
71,300 KB
testcase_02 AC 64 ms
71,116 KB
testcase_03 AC 76 ms
72,392 KB
testcase_04 AC 79 ms
72,500 KB
testcase_05 AC 79 ms
72,508 KB
testcase_06 AC 82 ms
72,528 KB
testcase_07 AC 77 ms
72,328 KB
testcase_08 AC 81 ms
71,988 KB
testcase_09 AC 90 ms
78,312 KB
testcase_10 AC 98 ms
77,884 KB
testcase_11 AC 112 ms
80,412 KB
testcase_12 AC 114 ms
80,308 KB
testcase_13 AC 108 ms
80,168 KB
testcase_14 AC 111 ms
80,160 KB
testcase_15 AC 233 ms
80,672 KB
testcase_16 AC 217 ms
80,656 KB
testcase_17 AC 539 ms
90,508 KB
testcase_18 AC 329 ms
83,056 KB
testcase_19 AC 310 ms
82,780 KB
testcase_20 AC 318 ms
83,056 KB
testcase_21 AC 517 ms
88,140 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

# わからない
# しかし確実なのはA0=0, A1=それ以後の2個ずつのxor
# すべての項が2**N未満
# あとはランダムに10**5回くらいテストするか、WAした
# 全iに対して100回ずつテストしよう
# max_testをやめてみるか

N = int(input())
A = []
#max_test = True
for i in range(2**N):
    a = int(input())
    A.append(a)
    #if a >= 2**N:
    #    max_test = False
A0_test = True
if A[0] != 0:
    A0_test = False
    
if N == 0:
    if A0_test == True:
        print('Yes')
    else:
        print('No')
    exit()
    
A1 = A[1]
A1_test = True
for i in range(1, 2**(N-1)):
    #print(A[i*2], A[i*2+1], A[i*2]^A[i*2+1])
    if A[i*2]^A[i*2+1] != A1:
        A1_test = False
        
#print(max_test, A0_test, A1_test)

import random
random_test = True
for i in range(1, 2**N):
    for r in range(10):
        j = random.randint(0, 2**N-1)
        if A[i^j] != A[i]^A[j]:
            random_test = False
            break

#if max_test == True and A0_test == True and A1_test == True and random_test == True:
if A0_test == True and A1_test == True and random_test == True:
    print('Yes')
else:
    print('No')
0