結果

問題 No.10 +か×か
ユーザー Navier_BoltzmannNavier_Boltzmann
提出日時 2022-11-28 09:08:33
言語 PyPy3
(7.3.13)
結果
TLE  
実行時間 -
コード長 932 bytes
コンパイル時間 860 ms
コンパイル使用メモリ 86,924 KB
実行使用メモリ 243,920 KB
最終ジャッジ日時 2023-07-28 00:38:23
合計ジャッジ時間 14,062 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 101 ms
78,080 KB
testcase_01 AC 105 ms
78,036 KB
testcase_02 AC 104 ms
78,288 KB
testcase_03 TLE -
testcase_04 WA -
testcase_05 WA -
testcase_06 TLE -
testcase_07 WA -
testcase_08 AC 550 ms
102,732 KB
testcase_09 AC 259 ms
89,424 KB
testcase_10 AC 104 ms
78,476 KB
testcase_11 AC 103 ms
78,424 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

# import pypyjit
# pypyjit.set_param('max_unroll_recursion=-1')
from collections import *
from functools import *
from itertools import *
from heapq import *
import sys,math

input = sys.stdin.readline

N = int(input())
T = int(input())
A = list(map(int,input().split()))
X = defaultdict(int)
M = 10**5+5
called = [0]*M
called[A[0]]=1
for i in range(N-1):
    
    target = []
    for j in range(M):
        if called[j]==i+1:
            target.append((X[j],j))
    target.sort()
    n = len(target)
    a = A[i+1]
    for x,j in target:
        if j+a<M:
            if called[j+a]==i+2:
                continue
            called[j+a]=i+2
            X[j+a] = x
        if j*a<M:
            if called[j*a]==i+2:
                continue
            called[j*a]=i+2
            X[j*a] = x + (1<<N-2-i)
def f(x):
    if x=='0':
        return '+'
    else:
        return '*'
print(''.join(map(f,list(bin(X[T])[2:].zfill(N-1)))))
0