結果

問題 No.1017 Reiwa Sequence
ユーザー vwxyzvwxyz
提出日時 2023-07-15 06:38:41
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,460 ms / 2,000 ms
コード長 569 bytes
コンパイル時間 388 ms
コンパイル使用メモリ 86,788 KB
実行使用メモリ 214,932 KB
最終ジャッジ日時 2023-10-14 21:18:38
合計ジャッジ時間 33,536 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 90 ms
71,356 KB
testcase_01 AC 91 ms
71,308 KB
testcase_02 AC 89 ms
71,616 KB
testcase_03 AC 101 ms
76,896 KB
testcase_04 AC 90 ms
71,616 KB
testcase_05 AC 90 ms
71,268 KB
testcase_06 AC 90 ms
71,436 KB
testcase_07 AC 89 ms
71,304 KB
testcase_08 AC 90 ms
71,580 KB
testcase_09 AC 117 ms
78,068 KB
testcase_10 AC 138 ms
78,980 KB
testcase_11 AC 126 ms
77,912 KB
testcase_12 AC 137 ms
78,924 KB
testcase_13 AC 111 ms
76,904 KB
testcase_14 AC 127 ms
77,992 KB
testcase_15 AC 139 ms
79,072 KB
testcase_16 AC 128 ms
77,880 KB
testcase_17 AC 157 ms
81,328 KB
testcase_18 AC 132 ms
78,048 KB
testcase_19 AC 690 ms
206,576 KB
testcase_20 AC 682 ms
206,580 KB
testcase_21 AC 679 ms
206,836 KB
testcase_22 AC 701 ms
206,700 KB
testcase_23 AC 652 ms
206,632 KB
testcase_24 AC 748 ms
206,684 KB
testcase_25 AC 738 ms
206,688 KB
testcase_26 AC 706 ms
206,580 KB
testcase_27 AC 550 ms
162,400 KB
testcase_28 AC 607 ms
178,524 KB
testcase_29 AC 150 ms
80,172 KB
testcase_30 AC 162 ms
82,200 KB
testcase_31 AC 226 ms
91,896 KB
testcase_32 AC 480 ms
139,616 KB
testcase_33 AC 145 ms
78,748 KB
testcase_34 AC 482 ms
139,664 KB
testcase_35 AC 91 ms
71,612 KB
testcase_36 AC 100 ms
76,440 KB
testcase_37 AC 441 ms
139,008 KB
testcase_38 AC 89 ms
71,304 KB
testcase_39 AC 427 ms
139,540 KB
testcase_40 AC 1,259 ms
214,932 KB
testcase_41 AC 1,235 ms
214,836 KB
testcase_42 AC 1,278 ms
214,856 KB
testcase_43 AC 1,269 ms
214,916 KB
testcase_44 AC 128 ms
92,832 KB
testcase_45 AC 1,460 ms
214,356 KB
testcase_46 AC 1,207 ms
214,744 KB
testcase_47 AC 1,237 ms
214,560 KB
testcase_48 AC 185 ms
100,060 KB
testcase_49 AC 146 ms
103,816 KB
testcase_50 AC 146 ms
103,868 KB
testcase_51 AC 95 ms
71,356 KB
testcase_52 AC 709 ms
206,892 KB
testcase_53 AC 305 ms
108,876 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
readline=sys.stdin.readline
from collections import defaultdict

N=int(readline())
A=list(map(int,readline().split()))
dct=defaultdict(list)
bit=1
while bit<1<<len(A):
    S=sum(A[i] for i in range(min(30,len(A))) if bit&1<<i)
    dct[S].append(bit)
    if len(dct[S])>=2:
        break
    bit+=1
else:
    print("No")
    exit()
bit0,bit1=dct[S][0],dct[S][1]
for i in range(len(A)):
    if i<30 and bit0&1<<i and not bit1&1<<i:
        A[i]*=-1
    elif i<30 and not bit0&1<<i and bit1&1<<i:
        A[i]*=1
    else:
        A[i]*=0
print("Yes")
print(*A)
0