結果
| 問題 | No.9 モンスターのレベル上げ |
| コンテスト | |
| ユーザー |
37zigen
|
| 提出日時 | 2016-03-09 21:24:51 |
| 言語 | Java (openjdk 23) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,282 bytes |
| コンパイル時間 | 2,441 ms |
| コンパイル使用メモリ | 83,676 KB |
| 実行使用メモリ | 62,340 KB |
| 最終ジャッジ日時 | 2024-09-24 17:04:45 |
| 合計ジャッジ時間 | 15,233 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 2 WA * 18 |
ソースコード
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");
}
}
37zigen