結果
問題 | No.216 FAC |
ユーザー |
![]() |
提出日時 | 2015-12-17 13:26:15 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 52 ms / 1,000 ms |
コード長 | 959 bytes |
コンパイル時間 | 2,037 ms |
コンパイル使用メモリ | 75,772 KB |
実行使用メモリ | 36,896 KB |
最終ジャッジ日時 | 2024-10-15 00:44:00 |
合計ジャッジ時間 | 4,077 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 24 |
ソースコード
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();}}}