結果
問題 | No.9 モンスターのレベル上げ |
ユーザー | spacia |
提出日時 | 2016-01-20 20:17:25 |
言語 | Java21 (openjdk 21) |
結果 |
AC
|
実行時間 | 614 ms / 5,000 ms |
コード長 | 1,298 bytes |
コンパイル時間 | 2,209 ms |
コンパイル使用メモリ | 75,496 KB |
実行使用メモリ | 58,056 KB |
最終ジャッジ日時 | 2023-09-06 04:27:38 |
合計ジャッジ時間 | 8,511 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge14 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 43 ms
49,792 KB |
testcase_01 | AC | 42 ms
49,484 KB |
testcase_02 | AC | 427 ms
57,588 KB |
testcase_03 | AC | 293 ms
57,676 KB |
testcase_04 | AC | 312 ms
57,360 KB |
testcase_05 | AC | 243 ms
57,056 KB |
testcase_06 | AC | 151 ms
55,732 KB |
testcase_07 | AC | 60 ms
51,512 KB |
testcase_08 | AC | 158 ms
56,204 KB |
testcase_09 | AC | 394 ms
57,492 KB |
testcase_10 | AC | 43 ms
49,452 KB |
testcase_11 | AC | 466 ms
57,988 KB |
testcase_12 | AC | 614 ms
58,056 KB |
testcase_13 | AC | 160 ms
56,820 KB |
testcase_14 | AC | 415 ms
57,652 KB |
testcase_15 | AC | 395 ms
57,472 KB |
testcase_16 | AC | 92 ms
52,232 KB |
testcase_17 | AC | 359 ms
57,820 KB |
testcase_18 | AC | 322 ms
57,992 KB |
testcase_19 | AC | 90 ms
52,108 KB |
ソースコード
import java.io.*; import java.util.*; import java.math.*; class Main { static int len; public static void out (Object o) { System.out.println(o); } public static int solve (int[] levelM , int[] levelE) { int ret = Integer.MAX_VALUE , maxI = -1; int[] bk = Arrays.copyOf(levelM , len); main:for (int i = 0; i < len; i++) { int win = 0; PriorityQueue<Integer> pq = new PriorityQueue<Integer>(); for (int j = 0; j < len; j++) pq.add(bk[j]); for (int j = i; win++ < len; j++) { j %= len; int p = pq.poll(); p += levelE[j] + 1; if ((p & 0xfff) >= ret) continue main; pq.add(p); } int max = 0; for (int j = 0; j < len; j++) max = Math.max(max , pq.poll() & 0xfff); ret = Math.min(ret , max); } return ret; } public static void main (String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); len = Integer.parseInt(br.readLine()); String[] line1 = br.readLine().split(" "); int[] levelM = new int[len]; String[] line2 = br.readLine().split(" "); int[] levelE = new int[len]; for (int i = 0; i < len; i++) { levelM[i] = Integer.parseInt(line1[i]) << 12; levelE[i] = (Integer.parseInt(line2[i]) >> 1) << 12; } out(solve(levelM , levelE)); } }