結果
| 問題 |
No.216 FAC
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-03-06 14:00:56 |
| 言語 | Java (openjdk 23) |
| 結果 |
AC
|
| 実行時間 | 75 ms / 1,000 ms |
| コード長 | 789 bytes |
| コンパイル時間 | 3,732 ms |
| コンパイル使用メモリ | 88,240 KB |
| 実行使用メモリ | 38,168 KB |
| 最終ジャッジ日時 | 2024-10-08 12:38:33 |
| 合計ジャッジ時間 | 7,053 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 24 |
ソースコード
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.stream.Stream;
public class No00000216_Main {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int n = Integer.parseInt(br.readLine());
int[] a = Stream.of(br.readLine().split(" ")).mapToInt(Integer::parseInt).toArray();
int[] b = Stream.of(br.readLine().split(" ")).mapToInt(Integer::parseInt).toArray();
int[] other = new int[100];
int point = 0;
for(int i = 0; i < n; i++) {
if(b[i] == 0) {
point += a[i];
} else {
other[b[i] - 1] += a[i];
}
}
Arrays.sort(other);
System.out.println(point >= other[99] ? "YES" : "NO");
}
}