結果

問題 No.1017 Reiwa Sequence
ユーザー Kiri8128Kiri8128
提出日時 2020-04-03 22:20:30
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 157 ms / 2,000 ms
コード長 698 bytes
コンパイル時間 285 ms
コンパイル使用メモリ 87,228 KB
実行使用メモリ 160,824 KB
最終ジャッジ日時 2023-09-16 02:36:04
合計ジャッジ時間 17,475 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 95 ms
137,168 KB
testcase_01 AC 96 ms
136,992 KB
testcase_02 AC 95 ms
136,900 KB
testcase_03 AC 96 ms
136,880 KB
testcase_04 AC 96 ms
136,876 KB
testcase_05 AC 97 ms
137,036 KB
testcase_06 AC 96 ms
136,880 KB
testcase_07 AC 95 ms
136,920 KB
testcase_08 AC 95 ms
136,884 KB
testcase_09 AC 103 ms
141,820 KB
testcase_10 AC 100 ms
141,928 KB
testcase_11 AC 104 ms
141,868 KB
testcase_12 AC 101 ms
141,788 KB
testcase_13 AC 97 ms
136,900 KB
testcase_14 AC 98 ms
141,816 KB
testcase_15 AC 102 ms
141,864 KB
testcase_16 AC 100 ms
141,852 KB
testcase_17 AC 99 ms
141,836 KB
testcase_18 AC 100 ms
141,856 KB
testcase_19 AC 132 ms
141,892 KB
testcase_20 AC 128 ms
141,792 KB
testcase_21 AC 130 ms
141,916 KB
testcase_22 AC 126 ms
141,844 KB
testcase_23 AC 126 ms
141,788 KB
testcase_24 AC 134 ms
141,792 KB
testcase_25 AC 128 ms
141,724 KB
testcase_26 AC 116 ms
142,008 KB
testcase_27 AC 123 ms
141,980 KB
testcase_28 AC 121 ms
141,792 KB
testcase_29 AC 99 ms
141,788 KB
testcase_30 AC 101 ms
141,872 KB
testcase_31 AC 102 ms
141,940 KB
testcase_32 AC 109 ms
141,872 KB
testcase_33 AC 98 ms
141,864 KB
testcase_34 AC 111 ms
141,888 KB
testcase_35 AC 97 ms
136,984 KB
testcase_36 AC 94 ms
136,876 KB
testcase_37 AC 112 ms
141,812 KB
testcase_38 AC 93 ms
137,132 KB
testcase_39 AC 111 ms
141,980 KB
testcase_40 AC 155 ms
153,224 KB
testcase_41 AC 157 ms
153,272 KB
testcase_42 AC 157 ms
152,364 KB
testcase_43 AC 156 ms
152,428 KB
testcase_44 AC 126 ms
152,940 KB
testcase_45 AC 156 ms
153,196 KB
testcase_46 AC 151 ms
152,476 KB
testcase_47 AC 144 ms
152,328 KB
testcase_48 AC 149 ms
160,484 KB
testcase_49 AC 141 ms
160,540 KB
testcase_50 AC 143 ms
160,824 KB
testcase_51 AC 95 ms
137,132 KB
testcase_52 AC 118 ms
141,804 KB
testcase_53 AC 105 ms
141,916 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 i in range(1, 1 << K):
    l = i & (-i)
    if i == l:
        x = B[D[l]]
    else:
        x = X[i^l] + B[D[l]]
    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)
        
        break
    else:
        Y[x] = i
else:
    print("No")
0