結果
問題 | No.216 FAC |
ユーザー | r.suzuki |
提出日時 | 2015-12-13 17:40:44 |
言語 | Java21 (openjdk 21) |
結果 |
RE
|
実行時間 | - |
コード長 | 709 bytes |
コンパイル時間 | 3,352 ms |
コンパイル使用メモリ | 72,412 KB |
実行使用メモリ | 58,136 KB |
最終ジャッジ日時 | 2023-10-13 14:58:09 |
合計ジャッジ時間 | 8,432 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge15 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 136 ms
55,808 KB |
testcase_01 | AC | 125 ms
55,896 KB |
testcase_02 | AC | 114 ms
56,388 KB |
testcase_03 | RE | - |
testcase_04 | RE | - |
testcase_05 | RE | - |
testcase_06 | RE | - |
testcase_07 | AC | 112 ms
56,140 KB |
testcase_08 | AC | 122 ms
55,576 KB |
testcase_09 | AC | 111 ms
56,036 KB |
testcase_10 | AC | 125 ms
55,560 KB |
testcase_11 | AC | 113 ms
55,952 KB |
testcase_12 | RE | - |
testcase_13 | RE | - |
testcase_14 | RE | - |
testcase_15 | RE | - |
testcase_16 | AC | 128 ms
56,392 KB |
testcase_17 | RE | - |
testcase_18 | AC | 123 ms
56,160 KB |
testcase_19 | RE | - |
testcase_20 | RE | - |
testcase_21 | AC | 123 ms
55,748 KB |
testcase_22 | RE | - |
testcase_23 | AC | 126 ms
55,568 KB |
testcase_24 | RE | - |
testcase_25 | RE | - |
testcase_26 | RE | - |
ソースコード
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); } }