結果
| 問題 |
No.216 FAC
|
| コンテスト | |
| ユーザー |
matsuyoshi30
|
| 提出日時 | 2018-05-07 22:22:10 |
| 言語 | Java (openjdk 23) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 725 bytes |
| コンパイル時間 | 1,945 ms |
| コンパイル使用メモリ | 74,080 KB |
| 実行使用メモリ | 41,788 KB |
| 最終ジャッジ日時 | 2024-06-28 02:21:57 |
| 合計ジャッジ時間 | 6,450 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 13 RE * 11 |
ソースコード
import java.util.*;
class Main {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int n = in.nextInt();
int[] a = new int[n];
int[] b = new int[n];
int[] c = new int[100];
for(int i = 0; i < n; i++) {
a[i] = in.nextInt();
}
int k_score = 0;
for(int i = 0; i < n; i++) {
b[i] = in.nextInt();
if(b[i] == 0) k_score += a[i];
else c[b[i]] += a[i];
}
String ans = "YES";
for(int i = 0; i < 100; i++) {
if(c[i] > k_score) {
ans = "NO";
break;
}
}
System.out.println(ans);
}
}
matsuyoshi30