結果

問題 No.9 モンスターのレベル上げ
ユーザー nCk_cvnCk_cv
提出日時 2016-02-18 15:38:50
言語 Java21
(openjdk 21)
結果
AC  
実行時間 894 ms / 5,000 ms
コード長 1,051 bytes
コンパイル時間 2,134 ms
コンパイル使用メモリ 75,188 KB
実行使用メモリ 61,860 KB
最終ジャッジ日時 2023-09-06 04:30:23
合計ジャッジ時間 13,895 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 127 ms
55,816 KB
testcase_01 AC 123 ms
58,312 KB
testcase_02 AC 859 ms
61,232 KB
testcase_03 AC 752 ms
60,960 KB
testcase_04 AC 565 ms
60,888 KB
testcase_05 AC 465 ms
61,260 KB
testcase_06 AC 326 ms
60,764 KB
testcase_07 AC 175 ms
55,864 KB
testcase_08 AC 355 ms
61,028 KB
testcase_09 AC 890 ms
61,312 KB
testcase_10 AC 121 ms
55,780 KB
testcase_11 AC 856 ms
60,776 KB
testcase_12 AC 847 ms
60,796 KB
testcase_13 AC 706 ms
60,988 KB
testcase_14 AC 894 ms
61,860 KB
testcase_15 AC 815 ms
61,504 KB
testcase_16 AC 217 ms
58,080 KB
testcase_17 AC 691 ms
61,432 KB
testcase_18 AC 601 ms
61,692 KB
testcase_19 AC 205 ms
58,328 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;
import java.awt.geom.*;
import java.io.*;

class Main {
	static int[] vx = {1,0,-1,0};
	static int[] vy = {0,1,0,-1};
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] a = new int[n];
		int[] b = new int[n];
		for(int i = 0; i < n; i++) {
			a[i] = sc.nextInt();
		}
		for(int i = 0; i < n; i++) {
			b[i] = sc.nextInt()/2;
		}
		int min = 2 << 29;
		for(int i = 0; i < n; i++) {
			PriorityQueue<Data> p = new PriorityQueue<Data>();
			for(int j = 0; j < n; j++) {
				p.add(new Data(a[j],0));
			}
			int max = 0;
			for(int j = 0; j < n; j++) {
				Data tmp = p.poll();
				tmp.b++;
				tmp.a += b[(j + i) % n];
				p.add(tmp);
				max = Math.max(max, tmp.b);
			}
			min = Math.min(min,max);
		}
		System.out.println(min);
		
	}
	static class Data implements Comparable<Data>{
		int a;
		int b;
		Data(int c, int d) {
			a = c;
			b = d;
		}
		@Override
		public int compareTo(Data o) {
			if(o.a == this.a) return this.b - o.b;
			return this.a - o.a;
		}
		
	}
}
0