結果

問題 No.814 ジジ抜き
ユーザー 37zigen37zigen
提出日時 2018-02-21 14:19:47
言語 Java21
(openjdk 21)
結果
MLE  
実行時間 -
コード長 946 bytes
コンパイル時間 4,261 ms
コンパイル使用メモリ 74,756 KB
実行使用メモリ 117,492 KB
最終ジャッジ日時 2023-10-13 11:55:44
合計ジャッジ時間 8,465 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 MLE -
testcase_01 AC 125 ms
55,544 KB
testcase_02 AC 129 ms
55,772 KB
testcase_03 MLE -
testcase_04 -- -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
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 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

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

public class Main {
	public static void main(String[] args) {
		new Main().run();
	}

	void run() {
		PriorityQueue<long[]> pq = new PriorityQueue<>(new Comparator<long[]>() {
			public int compare(long[] obj1, long[] obj2) {
				return Long.compare(obj1[1], obj2[1]);
			}
		});
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		for (int i = 0; i < n; ++i) {
			long K = sc.nextLong();
			long L = sc.nextLong();
			long D = sc.nextLong();
			pq.add(new long[] { K, L, D });
		}
		pq.add(new long[] { -1, Long.MAX_VALUE, Long.MAX_VALUE });
		while (!pq.isEmpty()) {
			long[] o1 = pq.poll();
			long[] o2 = pq.poll();
			if (o1[1] != o2[1]) {
				System.out.println(o1[1]);
				return;
			}
			--o1[0];
			--o2[0];
			o1[1] += 1L << o1[2];
			o2[1] += 1L << o2[2];
			if (o1[0] > 0)
				pq.add(o1);
			if (o2[0] > 0)
				pq.add(o2);
		}
	}
}
0