結果
問題 | No.107 モンスター |
ユーザー | ckawatak |
提出日時 | 2019-04-30 20:30:53 |
言語 | PyPy3 (7.3.15) |
結果 |
TLE
|
実行時間 | - |
コード長 | 556 bytes |
コンパイル時間 | 994 ms |
コンパイル使用メモリ | 87,072 KB |
実行使用メモリ | 80,984 KB |
最終ジャッジ日時 | 2023-08-30 02:34:06 |
合計ジャッジ時間 | 9,415 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge12 |
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 73 ms
71,720 KB |
testcase_01 | AC | 73 ms
71,552 KB |
testcase_02 | AC | 71 ms
71,204 KB |
testcase_03 | AC | 71 ms
71,376 KB |
testcase_04 | AC | 70 ms
71,336 KB |
testcase_05 | AC | 71 ms
71,464 KB |
testcase_06 | AC | 73 ms
71,524 KB |
testcase_07 | AC | 74 ms
71,356 KB |
testcase_08 | AC | 75 ms
71,564 KB |
testcase_09 | AC | 72 ms
71,328 KB |
testcase_10 | AC | 72 ms
71,468 KB |
testcase_11 | AC | 72 ms
71,568 KB |
testcase_12 | AC | 82 ms
76,032 KB |
testcase_13 | TLE | - |
testcase_14 | -- | - |
testcase_15 | -- | - |
testcase_16 | -- | - |
testcase_17 | -- | - |
testcase_18 | -- | - |
testcase_19 | -- | - |
testcase_20 | -- | - |
testcase_21 | -- | - |
testcase_22 | -- | - |
testcase_23 | -- | - |
testcase_24 | -- | - |
ソースコード
from itertools import permutations N = int(input()) D = list(map(int, input().split())) patterns = [] for i in range(N): patterns.append(i) answer = 0 for pattern in permutations(patterns): level = 100 max_level = 100 for p in pattern: if 0 < D[p]: level = min(max_level, level + D[p]) elif D[p] < 0: level = level + D[p] max_level = max_level + 100 if level <= 0: break answer = max(answer, level) if answer <= 0: print(0) else: print(answer)