結果

問題 No.9 モンスターのレベル上げ
ユーザー 37zigen37zigen
提出日時 2016-03-09 21:24:51
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 1,282 bytes
コンパイル時間 2,424 ms
コンパイル使用メモリ 86,324 KB
実行使用メモリ 64,144 KB
最終ジャッジ日時 2023-10-24 21:55:06
合計ジャッジ時間 14,276 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 136 ms
57,476 KB
testcase_11 WA -
testcase_12 AC 833 ms
63,948 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Date;
import java.util.PriorityQueue;
import java.util.Scanner;

public class Main {
	static class Tuple implements Comparable<Tuple>{
		int level;
		int count;
		Tuple(int level,int count){
			this.level=level;
			this.count=count;
		}
		public int compareTo(Tuple o){
			int value=Integer.compare(level,o.level);
			if(value==0){
				return Integer.compare(count,o.count);
			}
			return value;
		}
		
	}
	static int n=1500;
	
	public static void main(String[] args){
		Scanner sc=new Scanner(System.in);
		n=sc.nextInt();
		int[] party=new int[n];
		int[] enemy=new int[n];
		long exec_time=new Date().getTime();
		for(int i=0;i<n;i++){
			party[i]=sc.nextInt();
		}
		for(int i=0;i<n;i++){
			enemy[i]=sc.nextInt();
		}
		
		int min=n;
		
		for(int i=0;i<n;i++){
			PriorityQueue<Tuple> queue=new PriorityQueue<Tuple>(n);
			for(int j=0;j<n;j++){
				queue.add(new Tuple(party[j],0));
			}
			for(int k=0;k<n;k++){
				Tuple t=queue.poll();
				t.level+=enemy[(i+k)%n]/2;
				t.count++;
				queue.add(t);
			}
			
			Tuple[] tuples=queue.toArray(new Tuple[0]);
			int max=0;
			for(Tuple t:tuples){
				max=Math.max(max, t.count);
			}
			min=Math.max(min, max);
		}
		System.out.println(min);
		System.err.println(new Date().getTime()-exec_time+"ms");
		
	}
}
0