結果
問題 | No.9 モンスターのレベル上げ |
ユーザー | kou6839 |
提出日時 | 2014-11-09 16:33:51 |
言語 | Java21 (openjdk 21) |
結果 |
AC
|
実行時間 | 912 ms / 5,000 ms |
コード長 | 1,117 bytes |
コンパイル時間 | 2,357 ms |
コンパイル使用メモリ | 75,336 KB |
実行使用メモリ | 62,348 KB |
最終ジャッジ日時 | 2023-09-06 03:11:23 |
合計ジャッジ時間 | 14,076 ms |
ジャッジサーバーID (参考情報) |
judge15 / judge12 |
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 123 ms
55,816 KB |
testcase_01 | AC | 124 ms
55,716 KB |
testcase_02 | AC | 827 ms
62,024 KB |
testcase_03 | AC | 824 ms
62,348 KB |
testcase_04 | AC | 658 ms
61,832 KB |
testcase_05 | AC | 522 ms
62,012 KB |
testcase_06 | AC | 335 ms
60,888 KB |
testcase_07 | AC | 167 ms
55,684 KB |
testcase_08 | AC | 370 ms
60,988 KB |
testcase_09 | AC | 889 ms
62,012 KB |
testcase_10 | AC | 126 ms
55,492 KB |
testcase_11 | AC | 912 ms
61,208 KB |
testcase_12 | AC | 864 ms
61,064 KB |
testcase_13 | AC | 741 ms
61,360 KB |
testcase_14 | AC | 897 ms
62,108 KB |
testcase_15 | AC | 821 ms
61,696 KB |
testcase_16 | AC | 219 ms
58,188 KB |
testcase_17 | AC | 726 ms
62,088 KB |
testcase_18 | AC | 624 ms
62,092 KB |
testcase_19 | AC | 203 ms
57,972 KB |
ソースコード
import java.util.*; class status implements Comparable<status>{ int level; int count; status(int level,int count){ this.level=level; this.count = count; } @Override public int compareTo(status arg0) { int value = this.level - arg0.level; if(value==0){ return this.count-arg0.count; } return value; } } public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int N = sc.nextInt(); int[] party = new int[N]; int[] enemy = new int[N]; for(int i=0;i<N;i++){ party[i]=sc.nextInt(); } for(int i=0;i<N;i++){ enemy[i]=sc.nextInt(); } int ans=Integer.MAX_VALUE; for(int i=0;i<N;i++){ Queue<status> queue= new PriorityQueue<status>(); for(int j=0;j<N;j++){ queue.add(new status(party[j],0)); } for(int j=0;j<N;j++){ status temp = queue.poll(); temp.level+=enemy[(i+j)%N]/2; temp.count++; queue.add(temp); } int max=0; for(status a:queue){ max=Math.max(max, a.count); } ans=Math.min(ans,max); } System.out.println(ans); } }