結果
問題 | No.9 モンスターのレベル上げ |
ユーザー |
![]() |
提出日時 | 2014-11-09 16:33:51 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 878 ms / 5,000 ms |
コード長 | 1,117 bytes |
コンパイル時間 | 2,122 ms |
コンパイル使用メモリ | 77,540 KB |
実行使用メモリ | 60,328 KB |
最終ジャッジ日時 | 2024-06-23 22:03:10 |
合計ジャッジ時間 | 13,199 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 20 |
ソースコード
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); } }