結果
| 問題 |
No.10 +か×か
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2022-11-28 09:08:59 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 932 bytes |
| コンパイル時間 | 77 ms |
| コンパイル使用メモリ | 12,800 KB |
| 実行使用メモリ | 42,756 KB |
| 最終ジャッジ日時 | 2024-10-05 05:40:46 |
| 合計ジャッジ時間 | 6,731 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 3 TLE * 1 -- * 8 |
ソースコード
# 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)))))