結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 92 ms
71,384 KB
testcase_01 AC 91 ms
71,496 KB
testcase_02 AC 92 ms
71,576 KB
testcase_03 AC 98 ms
76,768 KB
testcase_04 AC 91 ms
71,420 KB
testcase_05 AC 90 ms
71,632 KB
testcase_06 AC 91 ms
71,576 KB
testcase_07 AC 89 ms
71,452 KB
testcase_08 AC 91 ms
71,640 KB
testcase_09 AC 125 ms
77,944 KB
testcase_10 AC 137 ms
78,836 KB
testcase_11 AC 127 ms
78,068 KB
testcase_12 AC 139 ms
78,816 KB
testcase_13 AC 110 ms
77,116 KB
testcase_14 AC 124 ms
78,168 KB
testcase_15 AC 137 ms
78,944 KB
testcase_16 AC 128 ms
78,084 KB
testcase_17 AC 153 ms
81,332 KB
testcase_18 AC 126 ms
77,972 KB
testcase_19 AC 697 ms
206,820 KB
testcase_20 AC 684 ms
206,680 KB
testcase_21 AC 680 ms
206,828 KB
testcase_22 AC 712 ms
206,844 KB
testcase_23 AC 693 ms
206,944 KB
testcase_24 AC 669 ms
206,832 KB
testcase_25 AC 813 ms
206,852 KB
testcase_26 AC 657 ms
206,744 KB
testcase_27 AC 491 ms
162,408 KB
testcase_28 AC 590 ms
178,884 KB
testcase_29 AC 150 ms
80,452 KB
testcase_30 AC 165 ms
82,524 KB
testcase_31 AC 215 ms
91,948 KB
testcase_32 AC 446 ms
139,684 KB
testcase_33 AC 143 ms
78,916 KB
testcase_34 AC 487 ms
139,740 KB
testcase_35 AC 94 ms
71,584 KB
testcase_36 AC 99 ms
76,520 KB
testcase_37 AC 444 ms
139,548 KB
testcase_38 AC 91 ms
71,740 KB
testcase_39 AC 451 ms
139,712 KB
testcase_40 AC 1,474 ms
214,684 KB
testcase_41 AC 1,242 ms
214,580 KB
testcase_42 AC 1,169 ms
214,420 KB
testcase_43 AC 1,219 ms
214,324 KB
testcase_44 AC 130 ms
93,188 KB
testcase_45 AC 1,325 ms
214,484 KB
testcase_46 AC 1,305 ms
214,376 KB
testcase_47 AC 1,264 ms
214,228 KB
testcase_48 AC 185 ms
99,728 KB
testcase_49 AC 145 ms
104,068 KB
testcase_50 AC 145 ms
103,876 KB
testcase_51 AC 91 ms
71,808 KB
testcase_52 AC 676 ms
206,848 KB
testcase_53 AC 289 ms
108,924 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(25,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<25 and bit0&1<<i and not bit1&1<<i:
        A[i]*=-1
    elif i<25 and not bit0&1<<i and bit1&1<<i:
        A[i]*=1
    else:
        A[i]*=0
print("Yes")
print(*A)
0