結果

問題 No.216 FAC
ユーザー koukonkokoukonko
提出日時 2015-12-17 13:22:35
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 957 bytes
コンパイル時間 4,891 ms
コンパイル使用メモリ 73,800 KB
実行使用メモリ 49,784 KB
最終ジャッジ日時 2023-10-14 12:40:49
合計ジャッジ時間 7,659 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 44 ms
49,404 KB
testcase_01 AC 44 ms
49,416 KB
testcase_02 AC 43 ms
49,452 KB
testcase_03 AC 45 ms
49,656 KB
testcase_04 AC 44 ms
49,252 KB
testcase_05 AC 43 ms
49,188 KB
testcase_06 AC 43 ms
49,284 KB
testcase_07 AC 42 ms
49,264 KB
testcase_08 AC 43 ms
47,432 KB
testcase_09 AC 44 ms
49,416 KB
testcase_10 AC 44 ms
49,280 KB
testcase_11 AC 43 ms
49,492 KB
testcase_12 AC 43 ms
49,356 KB
testcase_13 AC 43 ms
49,252 KB
testcase_14 AC 43 ms
49,316 KB
testcase_15 AC 43 ms
49,560 KB
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 44 ms
49,784 KB
testcase_19 AC 44 ms
49,180 KB
testcase_20 AC 44 ms
49,412 KB
testcase_21 AC 44 ms
49,224 KB
testcase_22 AC 45 ms
49,344 KB
testcase_23 AC 45 ms
49,492 KB
testcase_24 AC 44 ms
49,340 KB
testcase_25 AC 44 ms
49,268 KB
testcase_26 AC 43 ms
49,300 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