結果

問題 No.9 モンスターのレベル上げ
ユーザー spaciaspacia
提出日時 2016-01-20 16:25:31
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 1,219 bytes
コンパイル時間 2,472 ms
コンパイル使用メモリ 77,820 KB
実行使用メモリ 58,040 KB
最終ジャッジ日時 2023-10-21 13:32:54
合計ジャッジ時間 5,285 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 48 ms
53,644 KB
testcase_01 AC 49 ms
52,528 KB
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 48 ms
52,496 KB
testcase_11 AC 171 ms
57,864 KB
testcase_12 AC 83 ms
55,740 KB
testcase_13 AC 134 ms
56,516 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 AC 118 ms
57,116 KB
testcase_18 AC 110 ms
56,968 KB
testcase_19 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.*;
import java.util.*;
import java.math.*;

class Main {
	
	public static void out (Object o) {
		System.out.println(o);
	}
	
	public static int solve (int[] levelM , int[] levelE) {
		int len = levelM.length;
		Arrays.sort(levelM);
		for (int i = 0; i < len; i++) {
			int upIndex = 0;
			int min = levelM[0] & 0xfff;
			for (int j = 1; j < len && levelM[0] >> 12 == levelM[j] >> 12; j++) {
				int f = levelM[j] & 0xfff;
				if (f < min) {
					min = f;
					upIndex = j;
				}
			}
			levelM[upIndex]++;
			levelM[upIndex] += (levelE[i] >> 1) << 12;
			Arrays.sort(levelM);
		}
		int ret = 0;
		for (int i = 0; i < len; i++)
			ret = Math.max(ret , levelM[i] & 0xfff);
		return ret;
	}
	
	public static void main (String[] args) throws IOException {
		BufferedReader br = 
			new BufferedReader(new InputStreamReader(System.in));
		
		int len = Integer.parseInt(br.readLine());
		String[] line1 = br.readLine().split(" ");
		int[] levelM = new int[len];
		String[] line2 = br.readLine().split(" ");
		int[] levelE = new int[len];
		
		for (int i = 0; i < len; i++) {
			levelM[i] = Integer.parseInt(line1[i]) << 12;
			levelE[i] = Integer.parseInt(line2[i]);
		}
		
		out(solve(levelM , levelE));
	}
}
0