結果
| 問題 |
No.2329 Nafmo、イカサマをする
|
| コンテスト | |
| ユーザー |
gew1fw
|
| 提出日時 | 2025-06-12 20:37:56 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,054 bytes |
| コンパイル時間 | 561 ms |
| コンパイル使用メモリ | 81,808 KB |
| 実行使用メモリ | 53,996 KB |
| 最終ジャッジ日時 | 2025-06-12 20:38:09 |
| 合計ジャッジ時間 | 2,735 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 13 WA * 27 |
ソースコード
def main():
import sys
input = sys.stdin.read().split()
idx = 0
N = int(input[idx])
idx += 1
M = int(input[idx])
idx += 1
K = int(input[idx])
idx += 1
A = list(map(int, input[idx:idx+N])) if N > 0 else []
if N == 0:
print(0)
return
max_A = max(A) if A else 0
if max_A == 0:
print(0)
return
candidates = []
for k in range(1, K+1):
total = max_A * k
if total <= M:
candidates.append(total)
else:
# Check if any element can be <= M
possible = [a for a in A if a <= M]
if not possible:
candidates.append(0)
continue
max_possible = max(possible)
total = max_possible * k
if total <= M:
candidates.append(total)
else:
candidates.append(M)
max_candidate = max(candidates) if candidates else 0
print(max_candidate)
if __name__ == "__main__":
main()
gew1fw