結果
問題 | No.2227 King Kraken's Attack |
ユーザー | kakel-san |
提出日時 | 2023-02-24 23:46:40 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
RE
|
実行時間 | - |
コード長 | 2,094 bytes |
コンパイル時間 | 1,204 ms |
コンパイル使用メモリ | 106,496 KB |
実行使用メモリ | 19,072 KB |
最終ジャッジ日時 | 2024-10-02 11:31:03 |
合計ジャッジ時間 | 19,768 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 28 ms
18,816 KB |
testcase_01 | AC | 27 ms
18,944 KB |
testcase_02 | AC | 28 ms
18,816 KB |
testcase_03 | AC | 31 ms
18,944 KB |
testcase_04 | AC | 27 ms
19,072 KB |
testcase_05 | AC | 27 ms
18,944 KB |
testcase_06 | AC | 27 ms
19,072 KB |
testcase_07 | AC | 27 ms
18,688 KB |
testcase_08 | AC | 27 ms
18,816 KB |
testcase_09 | AC | 28 ms
18,816 KB |
testcase_10 | AC | 28 ms
18,944 KB |
testcase_11 | AC | 27 ms
19,072 KB |
testcase_12 | AC | 29 ms
18,688 KB |
testcase_13 | AC | 28 ms
18,944 KB |
testcase_14 | AC | 27 ms
18,816 KB |
testcase_15 | AC | 27 ms
18,816 KB |
testcase_16 | AC | 27 ms
18,816 KB |
testcase_17 | AC | 1,524 ms
18,816 KB |
testcase_18 | RE | - |
testcase_19 | AC | 27 ms
18,816 KB |
testcase_20 | AC | 1,442 ms
19,072 KB |
testcase_21 | AC | 1,493 ms
18,688 KB |
testcase_22 | AC | 404 ms
18,688 KB |
testcase_23 | AC | 58 ms
19,072 KB |
testcase_24 | AC | 812 ms
18,688 KB |
testcase_25 | RE | - |
testcase_26 | AC | 1,666 ms
19,072 KB |
testcase_27 | RE | - |
testcase_28 | AC | 1,458 ms
18,944 KB |
testcase_29 | AC | 1,446 ms
18,816 KB |
testcase_30 | AC | 1,495 ms
18,688 KB |
testcase_31 | AC | 1,268 ms
18,944 KB |
testcase_32 | AC | 666 ms
18,944 KB |
testcase_33 | AC | 544 ms
18,944 KB |
testcase_34 | AC | 408 ms
18,944 KB |
testcase_35 | AC | 716 ms
18,944 KB |
testcase_36 | AC | 662 ms
18,944 KB |
testcase_37 | RE | - |
testcase_38 | RE | - |
testcase_39 | RE | - |
testcase_40 | RE | - |
testcase_41 | RE | - |
testcase_42 | RE | - |
testcase_43 | RE | - |
testcase_44 | RE | - |
testcase_45 | AC | 27 ms
18,944 KB |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
using System; using static System.Console; using System.Linq; using System.Collections.Generic; class Program { static int NN => int.Parse(ReadLine()); static long[] NList => ReadLine().Split().Select(long.Parse).ToArray(); public static void Main() { Solve(); } static void Solve() { var c = NList; var (h, w, la, lb, ka, kb) = (c[0], c[1], c[2], c[3], c[4], c[5]); WriteLine(Attack(h, w, la, lb, ka, kb)); } static long Attack(long h, long w, long la, long lb, long ka, long kb) { var horimax = (h + la - 1) / la; var vertmax = (w + lb - 1) / lb; var ans = horimax + vertmax; checked { var kmax = Math.Max(ka, kb); if (kmax == 0) { return ans; } if (ka > 0) ans = Math.Min(ans, (h * w + ka - 1) / ka); if (kb > 0) ans = Math.Min(ans, (h * w + kb - 1) / kb); for (var ai = 0; ai <= h; ++ai) { if (ai == 0 && kb == 0) continue; var ok = h * w; var ng = -1L; while (ok - ng > 1) { var mid = (ok + ng) / 2; var hs = Math.Min(h, ai * la); var ws = Math.Min(w, mid * lb); var cnt = hs * ws + ai * ka + mid * kb; if (cnt >= h * w) ok = mid; else ng = mid; } ans = Math.Min(ans, ai + ok); } for (var bi = 0; bi <= w; ++bi) { if (bi == 0 && ka == 0) continue; var ok = h * w; var ng = -1L; while (ok - ng > 1) { var mid = (ok + ng) / 2; var hs = Math.Min(h, mid * la); var ws = Math.Min(w, bi * lb); var cnt = hs * ws + bi * kb + mid * ka; if (cnt >= h * w) ok = mid; else ng = mid; } ans = Math.Min(ans, bi + ok); } } return ans; } }