結果
| 問題 | No.1015 おつりは要らないです |
| コンテスト | |
| ユーザー |
ouoz1V
|
| 提出日時 | 2020-04-12 16:57:57 |
| 言語 | Nim (2.2.0) |
| 結果 |
AC
|
| 実行時間 | 94 ms / 2,000 ms |
| コード長 | 1,062 bytes |
| コンパイル時間 | 5,641 ms |
| コンパイル使用メモリ | 74,496 KB |
| 実行使用メモリ | 7,424 KB |
| 最終ジャッジ日時 | 2024-11-18 05:49:02 |
| 合計ジャッジ時間 | 8,766 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 33 |
コンパイルメッセージ
/home/judge/data/code/Main.nim(1, 45) Warning: Use the new 'sugar' module instead; future is deprecated [Deprecated] /home/judge/data/code/Main.nim(1, 75) Warning: imported and not used: 'intsets' [UnusedImport] /home/judge/data/code/Main.nim(1, 84) Warning: imported and not used: 'deques' [UnusedImport] /home/judge/data/code/Main.nim(1, 53) Warning: imported and not used: 'sets' [UnusedImport] /home/judge/data/code/Main.nim(1, 39) Warning: imported and not used: 'math' [UnusedImport] /home/judge/data/code/Main.nim(1, 45) Warning: imported and not used: 'future' [UnusedImport]
ソースコード
import sequtils, strutils, algorithm, math, future, sets, tables, hashes, intsets, deques
let read = iterator : string {.closure.} = (while true: (for s in stdin.readLine.split : yield s))
var
n,x,y,z = read().parseint
a = newseqwith(n, read().parseint + 1)
maisu = {1000: x, 5000: y, 10000: z}.toTable
proc calc(satsu: int) =
a.sort(Descending)
for i in 0 ..< n:
var
cur = a[i]
if a[i] >= satsu:
a[i] -= min(maisu[satsu] * satsu, a[i] div satsu * satsu)
maisu[satsu] = max(0, maisu[satsu] - (cur - a[i]) div satsu)
if maisu[satsu] == 0:
break
a.sort(Descending)
for i in 0 ..< n:
var
cur = a[i]
if a[i] > 0:
a[i] -= min(maisu[satsu] * satsu, (a[i] + satsu - 1) div satsu * satsu)
maisu[satsu] = max(0, maisu[satsu] - (cur - a[i] + satsu - 1) div satsu)
if maisu[satsu] == 0:
break
calc(10000)
calc(5000)
calc(1000)
if a.filterit(it > 0).len != 0:
echo "No"
else:
echo "Yes"
ouoz1V