結果
問題 | No.2390 Udon Coupon (Hard) |
ユーザー | 👑 Mizar |
提出日時 | 2023-07-03 21:11:17 |
言語 | JavaScript (node v21.7.1) |
結果 |
TLE
|
実行時間 | - |
コード長 | 776 bytes |
コンパイル時間 | 97 ms |
コンパイル使用メモリ | 5,332 KB |
実行使用メモリ | 51,836 KB |
最終ジャッジ日時 | 2023-09-26 08:06:59 |
合計ジャッジ時間 | 4,922 ms |
ジャッジサーバーID (参考情報) |
judge12 / judge14 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 82 ms
46,684 KB |
testcase_01 | AC | 82 ms
42,752 KB |
testcase_02 | AC | 104 ms
47,044 KB |
testcase_03 | AC | 115 ms
47,012 KB |
testcase_04 | AC | 107 ms
45,108 KB |
testcase_05 | AC | 412 ms
46,896 KB |
testcase_06 | AC | 76 ms
42,152 KB |
testcase_07 | AC | 77 ms
42,144 KB |
testcase_08 | AC | 76 ms
42,384 KB |
testcase_09 | TLE | - |
testcase_10 | -- | - |
testcase_11 | -- | - |
testcase_12 | -- | - |
testcase_13 | -- | - |
testcase_14 | -- | - |
testcase_15 | -- | - |
testcase_16 | -- | - |
testcase_17 | -- | - |
testcase_18 | -- | - |
testcase_19 | -- | - |
testcase_20 | -- | - |
testcase_21 | -- | - |
testcase_22 | -- | - |
testcase_23 | -- | - |
testcase_24 | -- | - |
testcase_25 | -- | - |
testcase_26 | -- | - |
testcase_27 | -- | - |
testcase_28 | -- | - |
testcase_29 | -- | - |
testcase_30 | -- | - |
testcase_31 | -- | - |
testcase_32 | -- | - |
testcase_33 | -- | - |
testcase_34 | -- | - |
testcase_35 | -- | - |
testcase_36 | -- | - |
testcase_37 | -- | - |
testcase_38 | -- | - |
testcase_39 | -- | - |
testcase_40 | -- | - |
testcase_41 | -- | - |
testcase_42 | -- | - |
testcase_43 | -- | - |
testcase_44 | -- | - |
testcase_45 | -- | - |
testcase_46 | -- | - |
testcase_47 | -- | - |
testcase_48 | -- | - |
testcase_49 | -- | - |
ソースコード
let l = require("fs").readFileSync("/dev/stdin", "utf8").trim().split("\n"); let n = BigInt(l[0]); let [a0, b0] = l[1].split(" ").map(s => BigInt(s)); let [a1, b1] = l[2].split(" ").map(s => BigInt(s)); let [a2, b2] = l[3].split(" ").map(s => BigInt(s)); function solve(n, ap, bp, aq, bq, ar, br) { let r = 0n, imax = ap * bq, jmax = ap * br; for (let i = 0n, di = n; i < imax && di >= 0n; i += bq, di -= aq) { for (let j = 0n, dj = di; j < jmax && dj >= 0n; j += br, dj -= ar) { let t = dj / ap * bp + i + j; r = (r < t) ? t : r; } } return r; } let r1 = solve(n, a0, b0, a1, b1, a2, b2); let r2 = solve(n, a1, b1, a2, b2, a0, b0); let r3 = solve(n, a2, b2, a0, b0, a1, b1); let r = (r1 > r2 && r1 > r3) ? r1 : (r2 > r3) ? r2 : r3; console.log(r.toString());