結果

問題 No.1017 Reiwa Sequence
ユーザー titiatitia
提出日時 2020-07-31 02:40:16
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,362 bytes
コンパイル時間 349 ms
コンパイル使用メモリ 86,932 KB
実行使用メモリ 129,232 KB
最終ジャッジ日時 2023-09-18 15:00:22
合計ジャッジ時間 19,141 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 83 ms
94,764 KB
testcase_01 AC 82 ms
94,520 KB
testcase_02 AC 81 ms
94,796 KB
testcase_03 AC 87 ms
99,252 KB
testcase_04 AC 81 ms
94,684 KB
testcase_05 AC 82 ms
94,696 KB
testcase_06 AC 81 ms
94,464 KB
testcase_07 AC 82 ms
94,728 KB
testcase_08 AC 81 ms
94,716 KB
testcase_09 AC 87 ms
99,536 KB
testcase_10 AC 88 ms
99,836 KB
testcase_11 AC 91 ms
99,684 KB
testcase_12 WA -
testcase_13 WA -
testcase_14 AC 87 ms
99,880 KB
testcase_15 AC 87 ms
99,784 KB
testcase_16 AC 88 ms
99,856 KB
testcase_17 AC 91 ms
99,964 KB
testcase_18 AC 90 ms
99,788 KB
testcase_19 AC 215 ms
100,324 KB
testcase_20 AC 221 ms
100,204 KB
testcase_21 AC 225 ms
100,216 KB
testcase_22 AC 220 ms
100,268 KB
testcase_23 AC 219 ms
100,052 KB
testcase_24 AC 221 ms
100,044 KB
testcase_25 AC 213 ms
100,200 KB
testcase_26 AC 206 ms
100,096 KB
testcase_27 AC 178 ms
100,296 KB
testcase_28 AC 186 ms
100,456 KB
testcase_29 AC 94 ms
99,832 KB
testcase_30 AC 98 ms
99,912 KB
testcase_31 AC 107 ms
99,792 KB
testcase_32 AC 150 ms
99,956 KB
testcase_33 AC 89 ms
99,636 KB
testcase_34 AC 155 ms
99,944 KB
testcase_35 AC 82 ms
94,624 KB
testcase_36 AC 84 ms
99,164 KB
testcase_37 AC 153 ms
99,536 KB
testcase_38 AC 80 ms
94,712 KB
testcase_39 AC 154 ms
99,904 KB
testcase_40 WA -
testcase_41 WA -
testcase_42 WA -
testcase_43 WA -
testcase_44 WA -
testcase_45 WA -
testcase_46 WA -
testcase_47 WA -
testcase_48 WA -
testcase_49 WA -
testcase_50 WA -
testcase_51 AC 81 ms
94,656 KB
testcase_52 AC 202 ms
100,096 KB
testcase_53 AC 117 ms
99,908 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline

N=int(input())
A=list(map(int,input().split()))

if N>=22:
    X=[-1]*(150000*20+1)
    for i in range(1,1<<20):
        SUM=0
        for j in range(20):
            if (1<<j) & i !=0:
                SUM+=A[j]
        if X[SUM]==-1:
            X[SUM]=i
        else:
            print("YES")
            ANS=[]
            k=X[SUM]
            l=i
            for j in range(20):
                if (1<<j) & k == 0 and (1<<j) & l != 0:
                    ANS.append(A[j])
                elif (1<<j) & k != 0 and (1<<j) & l == 0:
                    ANS.append(-A[j])
                else:
                    ANS.append(0)
            print(*(ANS+[0]*(N-20)))
            sys.exit()

else:
    X=[-1]*(150000*20+1)
    for i in range(1,1<<N):
        SUM=0
        for j in range(N):
            if (1<<j) & i !=0:
                SUM+=A[j]
        if X[SUM]==-1:
            X[SUM]=i
        else:
            print("Yes")
            ANS=[]
            k=X[SUM]
            l=i
            for j in range(N):
                if (1<<j) & k == 0 and (1<<j) & l != 0:
                    ANS.append(A[j])
                elif (1<<j) & k != 0 and (1<<j) & l == 0:
                    ANS.append(-A[j])
                else:
                    ANS.append(0)
            print(*ANS)
            sys.exit()
    print("No")
0