結果

問題 No.9 モンスターのレベル上げ
ユーザー kou6839kou6839
提出日時 2014-11-09 16:33:51
言語 Java17
(openjdk 17.0.1)
結果
AC  
実行時間 765 ms / 5,000 ms
コード長 1,117 bytes
コンパイル時間 1,691 ms
使用メモリ 47,316 KB
最終ジャッジ日時 2023-01-21 13:43:04
合計ジャッジ時間 12,413 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
使用メモリ
testcase_00 AC 94 ms
37,772 KB
testcase_01 AC 91 ms
37,512 KB
testcase_02 AC 750 ms
44,708 KB
testcase_03 AC 662 ms
46,532 KB
testcase_04 AC 534 ms
47,172 KB
testcase_05 AC 461 ms
47,316 KB
testcase_06 AC 318 ms
46,156 KB
testcase_07 AC 120 ms
38,076 KB
testcase_08 AC 358 ms
45,888 KB
testcase_09 AC 765 ms
46,784 KB
testcase_10 AC 93 ms
37,768 KB
testcase_11 AC 746 ms
46,152 KB
testcase_12 AC 727 ms
46,996 KB
testcase_13 AC 661 ms
46,092 KB
testcase_14 AC 754 ms
46,744 KB
testcase_15 AC 765 ms
47,216 KB
testcase_16 AC 206 ms
42,324 KB
testcase_17 AC 589 ms
46,368 KB
testcase_18 AC 566 ms
46,932 KB
testcase_19 AC 163 ms
39,572 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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);
	}
}	
0