結果
| 問題 | No.9 モンスターのレベル上げ |
| コンテスト | |
| ユーザー |
t8m8⛄️
|
| 提出日時 | 2016-02-12 00:55:11 |
| 言語 | Java (openjdk 23) |
| 結果 |
AC
|
| 実行時間 | 795 ms / 5,000 ms |
| コード長 | 1,324 bytes |
| コンパイル時間 | 4,023 ms |
| コンパイル使用メモリ | 83,860 KB |
| 実行使用メモリ | 48,608 KB |
| 最終ジャッジ日時 | 2024-06-23 23:19:04 |
| 合計ジャッジ時間 | 14,783 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 20 |
ソースコード
import java.util.*;
import java.io.*;
import java.awt.geom.*;
import java.math.*;
public class No009 {
static final Scanner in = new Scanner(System.in);
static final PrintWriter out = new PrintWriter(System.out,false);
static boolean debug = false;
static void solve() {
int n = in.nextInt();
PriorityQueue<int[]> pQ = new PriorityQueue<>(new Comparator<int[]>(){
public int compare(int[] a, int[] b) {
if (a[0] != b[0]) return a[0] - b[0];
return a[1] - b[1];
}
});
for (int i=0; i<n; i++) {
pQ.add(new int[]{in.nextInt(), 0});
}
int[] b = new int[n];
for (int i=0; i<n; i++) {
b[i] = in.nextInt();
}
int min = Integer.MAX_VALUE/2;
for (int i=0; i<n; i++) {
PriorityQueue<int[]> q = new PriorityQueue<>(pQ);
int max = 0;
for (int j=i, c=0; c<n; j=(j+1)%n, c++) {
int[] x = q.poll();
q.add(new int[]{x[0] + b[j]/2, x[1] + 1});
max = Math.max(max, x[1] + 1);
}
min = Math.min(min, max);
}
out.println(min);
}
public static void main(String[] args) {
debug = args.length > 0;
long start = System.currentTimeMillis();
solve();
out.flush();
long end = System.currentTimeMillis();
dump((end-start) + "ms");
in.close();
out.close();
}
static void dump(Object... o) { if (debug) System.err.println(Arrays.deepToString(o)); }
}
t8m8⛄️