結果

問題 No.1017 Reiwa Sequence
ユーザー ygd.ygd.
提出日時 2021-05-18 15:12:37
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 370 ms / 2,000 ms
コード長 571 bytes
コンパイル時間 242 ms
コンパイル使用メモリ 82,472 KB
実行使用メモリ 168,060 KB
最終ジャッジ日時 2024-04-17 04:39:49
合計ジャッジ時間 39,661 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 41 ms
54,280 KB
testcase_01 AC 41 ms
54,852 KB
testcase_02 AC 40 ms
54,488 KB
testcase_03 AC 45 ms
60,968 KB
testcase_04 AC 40 ms
54,004 KB
testcase_05 AC 42 ms
54,864 KB
testcase_06 AC 40 ms
54,216 KB
testcase_07 AC 40 ms
54,304 KB
testcase_08 AC 40 ms
54,020 KB
testcase_09 AC 49 ms
62,656 KB
testcase_10 AC 49 ms
63,596 KB
testcase_11 AC 49 ms
62,576 KB
testcase_12 AC 51 ms
64,532 KB
testcase_13 AC 48 ms
62,884 KB
testcase_14 AC 48 ms
63,256 KB
testcase_15 AC 48 ms
64,760 KB
testcase_16 AC 49 ms
63,152 KB
testcase_17 AC 53 ms
68,004 KB
testcase_18 AC 48 ms
63,172 KB
testcase_19 AC 315 ms
151,692 KB
testcase_20 AC 314 ms
151,900 KB
testcase_21 AC 309 ms
151,916 KB
testcase_22 AC 312 ms
151,716 KB
testcase_23 AC 309 ms
151,444 KB
testcase_24 AC 309 ms
151,528 KB
testcase_25 AC 303 ms
151,988 KB
testcase_26 AC 297 ms
151,740 KB
testcase_27 AC 218 ms
129,444 KB
testcase_28 AC 242 ms
137,648 KB
testcase_29 AC 52 ms
66,360 KB
testcase_30 AC 57 ms
69,952 KB
testcase_31 AC 73 ms
82,444 KB
testcase_32 AC 185 ms
129,800 KB
testcase_33 AC 50 ms
65,508 KB
testcase_34 AC 191 ms
129,364 KB
testcase_35 AC 42 ms
55,088 KB
testcase_36 AC 44 ms
59,932 KB
testcase_37 AC 189 ms
129,316 KB
testcase_38 AC 41 ms
53,884 KB
testcase_39 AC 190 ms
129,296 KB
testcase_40 AC 370 ms
167,508 KB
testcase_41 AC 357 ms
167,972 KB
testcase_42 AC 365 ms
167,984 KB
testcase_43 AC 361 ms
167,836 KB
testcase_44 AC 82 ms
92,912 KB
testcase_45 AC 357 ms
168,060 KB
testcase_46 AC 355 ms
167,692 KB
testcase_47 AC 354 ms
167,780 KB
testcase_48 AC 109 ms
105,176 KB
testcase_49 AC 101 ms
104,576 KB
testcase_50 AC 100 ms
104,808 KB
testcase_51 AC 40 ms
53,812 KB
testcase_52 AC 303 ms
151,920 KB
testcase_53 AC 112 ms
97,568 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

num = min(N, 22)
ret = [0]*N

from collections import defaultdict 
dic = defaultdict(list)

for i in range(1,1<<num):
    temp = 0
    for j in range(num):
        if (i>>j)&1 == 1:
            temp += A[j]
    dic[temp].append(i)
    if len(dic[temp]) == 2:
        a = dic[temp][0]
        b = dic[temp][1]
        for s in range(30):
            if (a>>s)&1 == 1:
                ret[s] = A[s]
            if (b>>s)&1 == 1:
                ret[s] = -A[s]
        print("Yes")
        print(*ret); exit()
print("No")
0