結果

問題 No.1739 Princess vs. Dragoness (& AoE)
ユーザー CuriousFairy315CuriousFairy315
提出日時 2021-11-12 22:02:11
言語 Java21
(openjdk 21)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 836 bytes
コンパイル時間 7,926 ms
コンパイル使用メモリ 74,880 KB
実行使用メモリ 75,032 KB
最終ジャッジ日時 2023-08-17 01:32:43
合計ジャッジ時間 70,677 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 133 ms
55,640 KB
testcase_01 AC 131 ms
55,740 KB
testcase_02 AC 136 ms
55,848 KB
testcase_03 AC 178 ms
58,940 KB
testcase_04 AC 2,575 ms
73,948 KB
testcase_05 TLE -
testcase_06 AC 1,670 ms
74,264 KB
testcase_07 AC 187 ms
58,592 KB
testcase_08 AC 1,389 ms
67,172 KB
testcase_09 AC 1,569 ms
72,516 KB
testcase_10 AC 1,433 ms
66,132 KB
testcase_11 AC 1,164 ms
63,500 KB
testcase_12 AC 359 ms
60,556 KB
testcase_13 AC 1,719 ms
70,848 KB
testcase_14 AC 2,221 ms
72,136 KB
testcase_15 AC 2,292 ms
72,800 KB
testcase_16 AC 1,496 ms
62,124 KB
testcase_17 AC 1,559 ms
69,268 KB
testcase_18 AC 1,907 ms
70,344 KB
testcase_19 AC 906 ms
67,520 KB
testcase_20 AC 900 ms
64,896 KB
testcase_21 AC 1,510 ms
71,876 KB
testcase_22 AC 2,164 ms
72,580 KB
testcase_23 AC 2,474 ms
75,032 KB
testcase_24 TLE -
testcase_25 AC 2,913 ms
74,200 KB
testcase_26 AC 2,552 ms
74,948 KB
testcase_27 TLE -
testcase_28 AC 2,712 ms
74,940 KB
testcase_29 TLE -
testcase_30 AC 2,842 ms
73,036 KB
testcase_31 AC 2,790 ms
73,168 KB
testcase_32 TLE -
testcase_33 AC 161 ms
55,608 KB
testcase_34 AC 174 ms
55,836 KB
testcase_35 AC 189 ms
55,704 KB
testcase_36 AC 200 ms
55,888 KB
testcase_37 AC 195 ms
55,656 KB
testcase_38 AC 222 ms
55,520 KB
testcase_39 AC 238 ms
58,528 KB
testcase_40 AC 218 ms
57,416 KB
testcase_41 AC 231 ms
58,328 KB
testcase_42 AC 195 ms
55,804 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Comparator;
import java.util.PriorityQueue;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		try (Scanner sc = new Scanner(System.in)) {
			int N = sc.nextInt(), A = sc.nextInt(), B = sc.nextInt(), X = sc.nextInt(), Y = sc.nextInt();
			int[] H = new int[N];
			for (int i = 0;i < N;++ i) H[i] = sc.nextInt();
			int ng = -1, ok = 1_000_000_000;
			while(ok - ng > 1) {
				int mid = ok + ng >> 1;
				PriorityQueue<Integer> pq = new PriorityQueue<>(Comparator.reverseOrder());
				for (int i : H) pq.add(i - mid);
				for (int i = 0;i < A;++ i) pq.add(pq.poll() - X);
				long sum = 0;
				while(!pq.isEmpty()) {
					if (pq.peek() > 0) sum += pq.poll();
					else break;
				}
				if ((long)B * Y >= sum) ok = mid;
				else ng = mid;
			}
			System.out.println(ok);
		}
	}
}
0