結果
問題 |
No.216 FAC
|
ユーザー |
![]() |
提出日時 | 2015-12-17 13:22:35 |
言語 | Java (openjdk 23) |
結果 |
WA
|
実行時間 | - |
コード長 | 957 bytes |
コンパイル時間 | 2,148 ms |
コンパイル使用メモリ | 77,976 KB |
実行使用メモリ | 52,440 KB |
最終ジャッジ日時 | 2024-09-16 07:30:52 |
合計ジャッジ時間 | 4,698 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 22 WA * 2 |
ソースコード
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(); } } }