結果

問題 No.1017 Reiwa Sequence
ユーザー Kiri8128Kiri8128
提出日時 2020-04-04 02:15:21
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 143 ms / 2,000 ms
コード長 763 bytes
コンパイル時間 266 ms
コンパイル使用メモリ 87,128 KB
実行使用メモリ 160,588 KB
最終ジャッジ日時 2023-09-16 05:13:28
合計ジャッジ時間 17,050 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 95 ms
136,640 KB
testcase_01 AC 96 ms
136,920 KB
testcase_02 AC 96 ms
136,800 KB
testcase_03 AC 98 ms
136,944 KB
testcase_04 AC 94 ms
137,044 KB
testcase_05 AC 95 ms
137,048 KB
testcase_06 AC 95 ms
136,756 KB
testcase_07 AC 94 ms
136,844 KB
testcase_08 AC 94 ms
137,044 KB
testcase_09 AC 99 ms
141,164 KB
testcase_10 AC 95 ms
141,220 KB
testcase_11 AC 96 ms
141,496 KB
testcase_12 AC 97 ms
141,160 KB
testcase_13 AC 96 ms
136,904 KB
testcase_14 AC 97 ms
141,364 KB
testcase_15 AC 99 ms
141,208 KB
testcase_16 AC 96 ms
141,344 KB
testcase_17 AC 98 ms
141,292 KB
testcase_18 AC 97 ms
141,492 KB
testcase_19 AC 106 ms
141,388 KB
testcase_20 AC 107 ms
141,280 KB
testcase_21 AC 108 ms
141,316 KB
testcase_22 AC 106 ms
141,152 KB
testcase_23 AC 107 ms
141,392 KB
testcase_24 AC 106 ms
141,248 KB
testcase_25 AC 110 ms
141,344 KB
testcase_26 AC 106 ms
141,424 KB
testcase_27 AC 105 ms
141,408 KB
testcase_28 AC 102 ms
141,224 KB
testcase_29 AC 96 ms
141,252 KB
testcase_30 AC 99 ms
141,344 KB
testcase_31 AC 101 ms
141,144 KB
testcase_32 AC 106 ms
141,240 KB
testcase_33 AC 99 ms
141,140 KB
testcase_34 AC 105 ms
141,228 KB
testcase_35 AC 95 ms
136,792 KB
testcase_36 AC 92 ms
136,860 KB
testcase_37 AC 104 ms
141,348 KB
testcase_38 AC 93 ms
136,864 KB
testcase_39 AC 103 ms
141,280 KB
testcase_40 AC 138 ms
153,000 KB
testcase_41 AC 137 ms
153,076 KB
testcase_42 AC 138 ms
151,988 KB
testcase_43 AC 139 ms
152,112 KB
testcase_44 AC 128 ms
153,060 KB
testcase_45 AC 137 ms
152,852 KB
testcase_46 AC 135 ms
152,164 KB
testcase_47 AC 132 ms
152,264 KB
testcase_48 AC 143 ms
159,984 KB
testcase_49 AC 141 ms
160,344 KB
testcase_50 AC 139 ms
160,588 KB
testcase_51 AC 95 ms
136,740 KB
testcase_52 AC 105 ms
141,392 KB
testcase_53 AC 99 ms
141,148 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
A = [int(a) for a in input().split()]
K = min(N, 22)
B = A[:K]

D = {1<<i: i for i in range(22)}
X = [0] * (1 << 22)
Y = [0] * (1 << 22)
for ii in range(K):
    a = B[ii]
    iii = 1 << ii
    for i in range(1 << ii, 1 << ii + 1):
        x = X[i - iii] + a
        X[i] = x
        if Y[x]:
            j = Y[x]
            k = i & j
            i ^= k
            j ^= k
            for s in range(K):
                if i >> s & 1:
                    pass
                elif j >> s & 1:
                    A[s] *= -1
                else:
                    A[s] = 0
            for s in range(K, N):
                A[s] = 0
            print("Yes")
            print(*A)
            exit()
        else:
            Y[x] = i
print("No")
0