結果

問題 No.10 +か×か
ユーザー Navier_BoltzmannNavier_Boltzmann
提出日時 2022-11-28 09:08:59
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 932 bytes
コンパイル時間 100 ms
コンパイル使用メモリ 12,928 KB
実行使用メモリ 40,420 KB
最終ジャッジ日時 2024-04-15 10:54:48
合計ジャッジ時間 6,842 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 84 ms
17,152 KB
testcase_01 AC 68 ms
11,776 KB
testcase_02 AC 67 ms
11,648 KB
testcase_03 TLE -
testcase_04 -- -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
権限があれば一括ダウンロードができます

ソースコード

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