結果
問題 | No.2390 Udon Coupon (Hard) |
ユーザー | 👑 Mizar |
提出日時 | 2023-07-03 20:00:17 |
言語 | JavaScript (node v21.7.1) |
結果 |
AC
|
実行時間 | 413 ms / 2,000 ms |
コード長 | 2,876 bytes |
コンパイル時間 | 194 ms |
コンパイル使用メモリ | 5,376 KB |
実行使用メモリ | 43,348 KB |
最終ジャッジ日時 | 2024-10-06 01:33:24 |
合計ジャッジ時間 | 7,966 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 57 ms
40,064 KB |
testcase_01 | AC | 59 ms
40,192 KB |
testcase_02 | AC | 55 ms
40,064 KB |
testcase_03 | AC | 56 ms
40,064 KB |
testcase_04 | AC | 56 ms
40,192 KB |
testcase_05 | AC | 82 ms
42,964 KB |
testcase_06 | AC | 57 ms
40,192 KB |
testcase_07 | AC | 54 ms
40,064 KB |
testcase_08 | AC | 58 ms
40,192 KB |
testcase_09 | AC | 324 ms
43,096 KB |
testcase_10 | AC | 55 ms
40,192 KB |
testcase_11 | AC | 53 ms
40,320 KB |
testcase_12 | AC | 54 ms
40,192 KB |
testcase_13 | AC | 53 ms
40,448 KB |
testcase_14 | AC | 55 ms
40,064 KB |
testcase_15 | AC | 53 ms
40,192 KB |
testcase_16 | AC | 53 ms
40,192 KB |
testcase_17 | AC | 54 ms
40,064 KB |
testcase_18 | AC | 54 ms
40,064 KB |
testcase_19 | AC | 55 ms
40,192 KB |
testcase_20 | AC | 53 ms
40,192 KB |
testcase_21 | AC | 54 ms
40,064 KB |
testcase_22 | AC | 56 ms
40,192 KB |
testcase_23 | AC | 56 ms
40,192 KB |
testcase_24 | AC | 130 ms
43,092 KB |
testcase_25 | AC | 139 ms
43,216 KB |
testcase_26 | AC | 132 ms
43,216 KB |
testcase_27 | AC | 137 ms
43,344 KB |
testcase_28 | AC | 124 ms
43,092 KB |
testcase_29 | AC | 239 ms
42,960 KB |
testcase_30 | AC | 217 ms
43,092 KB |
testcase_31 | AC | 240 ms
42,968 KB |
testcase_32 | AC | 253 ms
43,348 KB |
testcase_33 | AC | 233 ms
42,964 KB |
testcase_34 | AC | 413 ms
43,088 KB |
testcase_35 | AC | 373 ms
43,092 KB |
testcase_36 | AC | 369 ms
43,348 KB |
testcase_37 | AC | 386 ms
42,964 KB |
testcase_38 | AC | 371 ms
42,960 KB |
testcase_39 | AC | 157 ms
43,092 KB |
testcase_40 | AC | 126 ms
42,968 KB |
testcase_41 | AC | 142 ms
43,096 KB |
testcase_42 | AC | 124 ms
43,092 KB |
testcase_43 | AC | 144 ms
43,092 KB |
testcase_44 | AC | 132 ms
42,964 KB |
testcase_45 | AC | 113 ms
42,968 KB |
testcase_46 | AC | 88 ms
43,216 KB |
testcase_47 | AC | 98 ms
43,092 KB |
testcase_48 | AC | 144 ms
42,964 KB |
testcase_49 | AC | 54 ms
40,448 KB |
ソースコード
const b64str = 'AGFzbQEAAAABDAFgB35+fn5+fn4BfgMCAQAFAwEAEQcSAgZtZW1vcnkCAAVzb2x2ZQAACuEEAd4EAgF/Cn4CQCABUA0AIABCAFMNACABIAR+Ig9CAVMNACABIAZ+IhBCAFcEQCAAIAN9IQkgBCEIA0AgCCAPWQ0CIAQgCHwhCCAJQn9VIAkgA30hCQ0ACwwBC0IAIAV9IREgACEKA0BCACEJIAohCANAAkAgDiAJIAt8IAggAX8gAn58IgwgDiAMVRshDiAGIAl8IgkgEFkNACAIIBF8IAggBX0hCEJ/VQ0BCwsgBCALfCILIA9ZDQEgCiADfSIKQn9VDQALCwJAIANQDQAgAEIAUw0AIAMgBn4iD0IBUw0AQgAhCyACIAN+IhBCAFcEQCAAIAV9IQkgBiEIA0AgCCAPWQ0CIAYgCHwhCCAJQn9VIAkgBX0hCQ0ACwwBC0IAIAF9IREgACEKA0BCACEJIAohCANAAkAgDSAJIAt8IAggA38gBH58IgwgDSAMVRshDSACIAl8IgkgEFkNACAIIBF8IAggAX0hCEJ/VQ0BCwsgBiALfCILIA9ZDQEgCiAFfSIKQn9VDQALC0IAIQkCQCAFUCAAQgBTcg0AIAIgBX4iD0IBUw0AQgAhCyAEIAV+IhBCAFcEQCAAIAF9IQogAiEIA0AgCCAPWQ0CIAIgCHwhCCAKQn9VIAogAX0hCg0ACwwBC0IAIAN9IREDQEIAIQogACEIA0ACQCAJIAogC3wgCCAFfyAGfnwiDCAJIAxVGyEJIAQgCnwiCiAQWQ0AIAggEXwgCCADfSEIQn9VDQELCyACIAt8IgsgD1kNASAAIAF9IgBCf1UNAAsLIA4gDSAOIA1VGyIAIAkgACAJVRsLAG8JcHJvZHVjZXJzAghsYW5ndWFnZQEEUnVzdAAMcHJvY2Vzc2VkLWJ5AwVydXN0Yx0xLjcwLjAgKDkwYzU0MTgwNiAyMDIzLTA1LTMxKQZ3YWxydXMGMC4xOS4wDHdhc20tYmluZGdlbgYwLjIuODcALA90YXJnZXRfZmVhdHVyZXMCKw9tdXRhYmxlLWdsb2JhbHMrCHNpZ24tZXh0'; let imports = {}; let wasm; //const bytes = Buffer.from(b64str, 'base64'); const bytes = Uint8Array.from([...atob(b64str)].map(s=>s.charCodeAt(0))); const wasmModule = new WebAssembly.Module(bytes); const wasmInstance = new WebAssembly.Instance(wasmModule, imports); wasm = wasmInstance.exports; let l = require("fs").readFileSync("/dev/stdin", "utf8").trim().split("\n"); let n = BigInt(l[0]); let [a1, b1] = l[1].split(" ").map(s => BigInt(s)); let [a2, b2] = l[2].split(" ").map(s => BigInt(s)); let [a3, b3] = l[3].split(" ").map(s => BigInt(s)); console.log(wasm.solve(n,a1,b1,a2,b2,a3,b3).toString()); /* // WebAssembly Source Code (Rust): use wasm_bindgen::prelude::*; #[wasm_bindgen] pub fn solve(n: i64, a1: i64, b1: i64, a2: i64, b2: i64, a3: i64, b3: i64) -> i64 { co_solve(n as i64, [(a1, b1), (a2, b2), (a3, b3)]) .max(co_solve(n as i64, [(a2, b2), (a3, b3), (a1, b1)])) .max(co_solve(n as i64, [(a3, b3), (a1, b1), (a2, b2)])) } fn co_solve(n: i64, ab: [(i64, i64); 3]) -> i64 { let [(ap, bp), (aq, bq), (ar, br)] = ab; if ap == 0 { return 0; } let (imax, jmax) = (ap * bq, ap * br); let (mut r, mut i, mut di) = (0, 0, n); while i < imax && di >= 0 { let (mut j, mut dj) = (0, di); while j < jmax && dj >= 0 { r.chmax(dj / ap * bp + i + j); dj -= ar; j += br; } di -= aq; i += bq; } r } trait Change { fn chmax(&mut self, x: Self); fn chmin(&mut self, x: Self); } impl<T: PartialOrd> Change for T { fn chmax(&mut self, x: T) { if *self < x { *self = x; } } fn chmin(&mut self, x: T) { if *self > x { *self = x; } } } */