結果
問題 | No.1739 Princess vs. Dragoness (& AoE) |
ユーザー | tenten |
提出日時 | 2021-11-15 09:29:21 |
言語 | Java21 (openjdk 21) |
結果 |
AC
|
実行時間 | 2,116 ms / 3,000 ms |
コード長 | 2,045 bytes |
コンパイル時間 | 2,075 ms |
コンパイル使用メモリ | 78,144 KB |
実行使用メモリ | 57,632 KB |
最終ジャッジ日時 | 2024-05-08 05:10:06 |
合計ジャッジ時間 | 39,171 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 50 ms
36,760 KB |
testcase_01 | AC | 51 ms
36,748 KB |
testcase_02 | AC | 51 ms
37,204 KB |
testcase_03 | AC | 51 ms
37,008 KB |
testcase_04 | AC | 1,446 ms
53,796 KB |
testcase_05 | AC | 2,102 ms
55,272 KB |
testcase_06 | AC | 398 ms
53,556 KB |
testcase_07 | AC | 52 ms
37,092 KB |
testcase_08 | AC | 733 ms
48,100 KB |
testcase_09 | AC | 835 ms
47,556 KB |
testcase_10 | AC | 868 ms
47,496 KB |
testcase_11 | AC | 564 ms
46,516 KB |
testcase_12 | AC | 121 ms
39,700 KB |
testcase_13 | AC | 944 ms
51,944 KB |
testcase_14 | AC | 1,427 ms
54,208 KB |
testcase_15 | AC | 1,242 ms
54,644 KB |
testcase_16 | AC | 1,009 ms
47,284 KB |
testcase_17 | AC | 744 ms
49,912 KB |
testcase_18 | AC | 1,080 ms
48,476 KB |
testcase_19 | AC | 356 ms
46,984 KB |
testcase_20 | AC | 453 ms
48,252 KB |
testcase_21 | AC | 669 ms
47,048 KB |
testcase_22 | AC | 1,194 ms
54,548 KB |
testcase_23 | AC | 1,358 ms
55,216 KB |
testcase_24 | AC | 2,116 ms
56,584 KB |
testcase_25 | AC | 1,780 ms
55,520 KB |
testcase_26 | AC | 1,494 ms
56,284 KB |
testcase_27 | AC | 1,988 ms
57,180 KB |
testcase_28 | AC | 1,483 ms
56,788 KB |
testcase_29 | AC | 2,000 ms
55,936 KB |
testcase_30 | AC | 1,569 ms
56,140 KB |
testcase_31 | AC | 1,667 ms
56,676 KB |
testcase_32 | AC | 2,079 ms
57,632 KB |
testcase_33 | AC | 59 ms
36,872 KB |
testcase_34 | AC | 50 ms
36,740 KB |
testcase_35 | AC | 57 ms
37,092 KB |
testcase_36 | AC | 69 ms
37,392 KB |
testcase_37 | AC | 50 ms
37,172 KB |
testcase_38 | AC | 82 ms
38,328 KB |
testcase_39 | AC | 97 ms
38,668 KB |
testcase_40 | AC | 73 ms
37,908 KB |
testcase_41 | AC | 83 ms
38,280 KB |
testcase_42 | AC | 60 ms
37,120 KB |
ソースコード
import java.util.*; import java.io.*; public class Main { public static void main(String[] args) throws Exception { Scanner sc = new Scanner(); int n = sc.nextInt(); int a = sc.nextInt(); int b = sc.nextInt(); int x = sc.nextInt(); long y = sc.nextInt(); int[] helths = new int[n]; for (int i = 0; i < n; i++) { helths[i] = sc.nextInt(); } PriorityQueue<Integer> queue = new PriorityQueue<>(); int left = -1; int right = 1000000000; while (right - left > 1) { int m = (left + right) / 2; for (int i = 0; i < n; i++) { if (helths[i] - m > 0) { queue.add(m - helths[i]); } } for (int i = 0; i < a && queue.size() > 0; i++) { int z = -queue.poll(); if (z > x) { queue.add(x - z); } } long sum = 0; while (queue.size() > 0) { sum -= queue.poll(); } if (sum <= b * y) { right = m; } else { left = m; } } System.out.println(right); } } class Scanner { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st = new StringTokenizer(""); public Scanner() throws Exception { } public int nextInt() throws Exception { return Integer.parseInt(next()); } public long nextLong() throws Exception { return Long.parseLong(next()); } public double nextDouble() throws Exception { return Double.parseDouble(next()); } public String nextLine() throws Exception { return br.readLine(); } public String next() throws Exception { if (!st.hasMoreTokens()) { st = new StringTokenizer(br.readLine()); } return st.nextToken(); } }