結果
| 問題 |
No.216 FAC
|
| コンテスト | |
| ユーザー |
matsuyoshi30
|
| 提出日時 | 2018-05-07 22:27:21 |
| 言語 | Java (openjdk 23) |
| 結果 |
AC
|
| 実行時間 | 154 ms / 1,000 ms |
| コード長 | 727 bytes |
| コンパイル時間 | 2,114 ms |
| コンパイル使用メモリ | 75,108 KB |
| 実行使用メモリ | 41,628 KB |
| 最終ジャッジ日時 | 2024-06-28 02:22:12 |
| 合計ジャッジ時間 | 6,509 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 24 |
ソースコード
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]-1] += 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