結果
問題 | No.9 モンスターのレベル上げ |
ユーザー | t8m8⛄️ |
提出日時 | 2016-02-12 00:55:11 |
言語 | Java21 (openjdk 21) |
結果 |
AC
|
実行時間 | 817 ms / 5,000 ms |
コード長 | 1,324 bytes |
コンパイル時間 | 3,836 ms |
コンパイル使用メモリ | 79,868 KB |
実行使用メモリ | 61,600 KB |
最終ジャッジ日時 | 2023-09-06 04:29:20 |
合計ジャッジ時間 | 15,006 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge14 |
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 140 ms
56,612 KB |
testcase_01 | AC | 143 ms
55,496 KB |
testcase_02 | AC | 806 ms
60,564 KB |
testcase_03 | AC | 676 ms
60,644 KB |
testcase_04 | AC | 533 ms
60,784 KB |
testcase_05 | AC | 456 ms
59,052 KB |
testcase_06 | AC | 357 ms
59,684 KB |
testcase_07 | AC | 173 ms
56,288 KB |
testcase_08 | AC | 381 ms
60,880 KB |
testcase_09 | AC | 817 ms
60,704 KB |
testcase_10 | AC | 141 ms
55,964 KB |
testcase_11 | AC | 754 ms
60,892 KB |
testcase_12 | AC | 731 ms
61,116 KB |
testcase_13 | AC | 697 ms
61,600 KB |
testcase_14 | AC | 799 ms
61,508 KB |
testcase_15 | AC | 768 ms
60,900 KB |
testcase_16 | AC | 236 ms
59,024 KB |
testcase_17 | AC | 643 ms
61,088 KB |
testcase_18 | AC | 537 ms
60,692 KB |
testcase_19 | AC | 217 ms
58,656 KB |
ソースコード
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)); } }