結果

問題 No.1017 Reiwa Sequence
ユーザー lemondolemondo
提出日時 2020-12-23 10:40:51
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 384 ms / 2,000 ms
コード長 868 bytes
コンパイル時間 251 ms
コンパイル使用メモリ 81,604 KB
実行使用メモリ 149,812 KB
最終ジャッジ日時 2023-10-21 15:05:53
合計ジャッジ時間 38,794 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
53,360 KB
testcase_01 AC 37 ms
53,356 KB
testcase_02 AC 39 ms
53,360 KB
testcase_03 AC 43 ms
59,540 KB
testcase_04 AC 37 ms
53,360 KB
testcase_05 AC 37 ms
53,360 KB
testcase_06 AC 36 ms
53,360 KB
testcase_07 AC 37 ms
53,360 KB
testcase_08 AC 37 ms
53,360 KB
testcase_09 AC 46 ms
62,316 KB
testcase_10 AC 48 ms
64,364 KB
testcase_11 AC 47 ms
62,320 KB
testcase_12 AC 49 ms
66,412 KB
testcase_13 AC 45 ms
62,184 KB
testcase_14 AC 47 ms
62,316 KB
testcase_15 AC 47 ms
64,360 KB
testcase_16 AC 47 ms
62,316 KB
testcase_17 AC 53 ms
69,840 KB
testcase_18 AC 47 ms
62,316 KB
testcase_19 AC 356 ms
140,164 KB
testcase_20 AC 354 ms
140,160 KB
testcase_21 AC 361 ms
140,164 KB
testcase_22 AC 365 ms
140,164 KB
testcase_23 AC 342 ms
140,160 KB
testcase_24 AC 349 ms
140,160 KB
testcase_25 AC 355 ms
140,164 KB
testcase_26 AC 336 ms
140,160 KB
testcase_27 AC 253 ms
116,740 KB
testcase_28 AC 289 ms
122,568 KB
testcase_29 AC 54 ms
71,376 KB
testcase_30 AC 64 ms
77,996 KB
testcase_31 AC 87 ms
84,216 KB
testcase_32 AC 200 ms
101,336 KB
testcase_33 AC 50 ms
68,596 KB
testcase_34 AC 214 ms
101,336 KB
testcase_35 AC 37 ms
53,360 KB
testcase_36 AC 41 ms
59,464 KB
testcase_37 AC 204 ms
101,336 KB
testcase_38 AC 37 ms
53,360 KB
testcase_39 AC 204 ms
101,336 KB
testcase_40 AC 384 ms
149,400 KB
testcase_41 AC 384 ms
149,388 KB
testcase_42 AC 377 ms
149,692 KB
testcase_43 AC 378 ms
149,812 KB
testcase_44 AC 81 ms
92,776 KB
testcase_45 AC 379 ms
149,316 KB
testcase_46 AC 369 ms
149,716 KB
testcase_47 AC 371 ms
149,692 KB
testcase_48 AC 109 ms
104,668 KB
testcase_49 AC 101 ms
104,488 KB
testcase_50 AC 100 ms
104,816 KB
testcase_51 AC 37 ms
53,356 KB
testcase_52 AC 357 ms
140,164 KB
testcase_53 AC 120 ms
90,624 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return list(map(int, input().split()))
sys.setrecursionlimit(10**9)

N = int(input())
As = mapint()

over22 = False
if N>=22:
    diff = N-22
    N = 22
    over22 = True

used = {}
for i in range(1<<N):
    tmp = 0
    lis = []
    for j in range(N):
        if (i>>j)&1:
            tmp += As[j]
            lis.append(As[j])
        else:
            lis.append(0)
    
    if tmp in used:
        neg_lis = []
        neg_i = used[tmp]
        for j in range(N):
            if (neg_i>>j)&1:
                neg_lis.append(-As[j])
            else:
                neg_lis.append(0)
        for i in range(N):
            lis[i] += neg_lis[i]
        print('Yes')
        if over22:
            lis.extend([0]*diff)
        print(*lis)
        exit()
    used[tmp] = i
else:
    print('No')
0