結果

問題 No.1017 Reiwa Sequence
ユーザー titiatitia
提出日時 2020-04-03 23:10:09
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 950 bytes
コンパイル時間 288 ms
コンパイル使用メモリ 86,940 KB
実行使用メモリ 81,804 KB
最終ジャッジ日時 2023-09-16 04:26:29
合計ジャッジ時間 12,629 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 97 ms
78,896 KB
testcase_01 AC 97 ms
71,520 KB
testcase_02 AC 96 ms
71,496 KB
testcase_03 AC 104 ms
77,792 KB
testcase_04 AC 96 ms
71,784 KB
testcase_05 AC 96 ms
71,516 KB
testcase_06 AC 98 ms
71,564 KB
testcase_07 AC 96 ms
71,256 KB
testcase_08 AC 97 ms
71,248 KB
testcase_09 AC 131 ms
77,488 KB
testcase_10 AC 782 ms
77,696 KB
testcase_11 AC 118 ms
77,804 KB
testcase_12 AC 643 ms
77,788 KB
testcase_13 AC 466 ms
77,600 KB
testcase_14 AC 150 ms
77,544 KB
testcase_15 AC 255 ms
77,564 KB
testcase_16 AC 149 ms
77,648 KB
testcase_17 AC 1,344 ms
77,496 KB
testcase_18 AC 149 ms
77,708 KB
testcase_19 TLE -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
testcase_39 -- -
testcase_40 -- -
testcase_41 -- -
testcase_42 -- -
testcase_43 -- -
testcase_44 -- -
testcase_45 -- -
testcase_46 -- -
testcase_47 -- -
testcase_48 -- -
testcase_49 -- -
testcase_50 -- -
testcase_51 -- -
testcase_52 -- -
testcase_53 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline

N=int(input())
A=list(map(int,input().split()))
A=[abs(a) for a in A]

from collections import Counter
C=Counter(A)

x=0
for c in C:
    if C[c]>1:
        x=c
        break

if x!=0:
    flag=0

    ANS=[]
    for a in A:
        if a!=x or flag==2:
            ANS.append(a)
        else:
            if flag==0:
                ANS.append(x)
                flag+=1
            elif flag==1:
                ANS.append(-x)
                flag+=1
                
    print("Yes")
    print(*ANS)
    sys.exit()


M=min(15,N)
from itertools import product
ITER=product([-1,0,1],repeat=M)

for ite in ITER:
    if max(ite)==min(ite)==0:
        continue
    S=0
    for i in range(M):
        S+=A[i]*ite[i]

    if S==0:
        ANS=[]
        for i in range(M):
            ANS.append(ite[i]*A[i])
        ANS+=[0]*abs(N-M)
        print("Yes")
        print(*ANS)
        break
else:
    print("No")
    

0