結果

問題 No.216 FAC
ユーザー koukonkokoukonko
提出日時 2015-12-17 13:26:15
言語 Java21
(openjdk 21)
結果
AC  
実行時間 56 ms / 1,000 ms
コード長 959 bytes
コンパイル時間 2,147 ms
コンパイル使用メモリ 77,304 KB
実行使用メモリ 50,416 KB
最終ジャッジ日時 2024-04-23 01:29:50
合計ジャッジ時間 4,538 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 55 ms
50,124 KB
testcase_01 AC 53 ms
50,328 KB
testcase_02 AC 54 ms
50,180 KB
testcase_03 AC 54 ms
50,336 KB
testcase_04 AC 55 ms
50,284 KB
testcase_05 AC 54 ms
50,376 KB
testcase_06 AC 55 ms
50,204 KB
testcase_07 AC 53 ms
50,332 KB
testcase_08 AC 52 ms
50,016 KB
testcase_09 AC 53 ms
50,356 KB
testcase_10 AC 55 ms
49,836 KB
testcase_11 AC 55 ms
50,332 KB
testcase_12 AC 54 ms
50,040 KB
testcase_13 AC 56 ms
50,312 KB
testcase_14 AC 54 ms
50,264 KB
testcase_15 AC 53 ms
50,128 KB
testcase_16 AC 55 ms
50,284 KB
testcase_17 AC 55 ms
50,292 KB
testcase_18 AC 55 ms
50,284 KB
testcase_19 AC 54 ms
50,052 KB
testcase_20 AC 54 ms
50,268 KB
testcase_21 AC 56 ms
50,320 KB
testcase_22 AC 54 ms
50,244 KB
testcase_23 AC 54 ms
50,288 KB
testcase_24 AC 54 ms
49,920 KB
testcase_25 AC 54 ms
50,416 KB
testcase_26 AC 55 ms
50,308 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {
	public static void main(String[] args) {
		BufferedReader read = new BufferedReader(new InputStreamReader(System.in));

		try {
			int[] total = new int[100];
			int player = 0;

			int N = Integer.parseInt(read.readLine());

			String[] box = read.readLine().split(" ");
			int[] point = new int[N];
			for (int i = 0; i < N; ++i) {
				point[i] = Integer.parseInt(box[i]);
			}

			box = read.readLine().split(" ");
			for (int i = 0; i < N; ++i) {
				int index = Integer.parseInt(box[i]);
				if (index == 0) {
					player += point[i];
				} else {
					total[index - 1] += point[i];
				}
			}
			int max = -1;
			for (int i = 0; i < 100; ++i) {
				if (total[i] > max) {
					max = total[i];
				}
			}
			if (max <= player) {
				System.out.println("YES");
			} else {
				System.out.println("NO");
			}

		} catch (Exception e) {
			e.printStackTrace();
		}
	}
}
0