結果
問題 |
No.216 FAC
|
ユーザー |
![]() |
提出日時 | 2015-12-13 17:40:44 |
言語 | Java (openjdk 23) |
結果 |
RE
|
実行時間 | - |
コード長 | 709 bytes |
コンパイル時間 | 3,414 ms |
コンパイル使用メモリ | 74,556 KB |
実行使用メモリ | 41,860 KB |
最終ジャッジ日時 | 2024-09-15 11:44:01 |
合計ジャッジ時間 | 8,381 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 9 RE * 15 |
ソースコード
public class No_216 { public static void main(String[] args) { java.util.Scanner sc = new java.util.Scanner(System.in); int n = sc.nextInt(); int[] score = new int[n]; int[] answeredNum = new int[n]; for (int i = 0; i < n; i++) { score[i] = sc.nextInt(); } for (int i = 0; i < n; i++) { answeredNum[i] = sc.nextInt(); } int kScore = 0; int[] personScore = new int[n]; for (int i = 0; i < n; i++) { if (answeredNum[i] == 0) { kScore += score[i]; } else { personScore[answeredNum[i]] += score[i]; } } java.util.Arrays.sort(personScore); int maxScore = personScore[n - 1]; String ans = kScore >= maxScore ? "YES" : "NO"; System.out.println(ans); } }