結果
問題 | No.10 +か×か |
ユーザー |
![]() |
提出日時 | 2017-07-20 21:09:24 |
言語 | Nim (2.2.0) |
結果 |
AC
|
実行時間 | 90 ms / 5,000 ms |
コード長 | 695 bytes |
コンパイル時間 | 5,068 ms |
コンパイル使用メモリ | 65,280 KB |
実行使用メモリ | 34,944 KB |
最終ジャッジ日時 | 2024-12-14 15:40:08 |
合計ジャッジ時間 | 5,551 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 12 |
ソースコード
import sequtils,strutils proc p2(i : int):int64= 1.int64 shl i var N = stdin.readline.parseInt T = stdin.readline.parseInt A = stdin.readline.split.map(parseInt) total : array[50,array[100001,int64]] i : int64 ans = "" total[0][A[0]] = p2(51) for n in 1..<N: for j in 1..T: if total[n - 1][j] > 0 and j * A[n] <= T: total[n][j * A[n]] = max(total[n][j * A[n]], total[n - 1][j]) if total[n - 1][j] > 0 and j + A[n] <= T: total[n][j + A[n]] = max(total[n][j + A[n]], total[n - 1][j] + p2(51 - n)) for j in 1..<N: i = total[N - 1][T] if (i and p2(51 - j)) > 0: ans &= "+" else: ans &= "*" echo ans