結果
問題 |
No.216 FAC
|
ユーザー |
![]() |
提出日時 | 2017-10-14 17:01:03 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 125 ms / 1,000 ms |
コード長 | 664 bytes |
コンパイル時間 | 1,702 ms |
コンパイル使用メモリ | 74,860 KB |
実行使用メモリ | 54,268 KB |
最終ジャッジ日時 | 2024-11-17 14:41:45 |
合計ジャッジ時間 | 5,376 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 24 |
ソースコード
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int[] a = new int[n]; int[] b = new int[n]; for(int i = 0 ; i < n ; i++) a[i] = sc.nextInt(); for(int i = 0 ; i < n ; i++) b[i] = sc.nextInt(); int[] point = new int[100]; int max = -1001001001; int ret = 0; for(int i = 0 ; i < n ; i++) { if(b[i] != 0) { point[b[i] - 1] += a[i]; } else { ret += a[i]; } } for(int i = 0 ; i < 100 ; i++) { max = Math.max(max, point[i]); } if(ret >= max) { System.out.println("YES"); } else { System.out.println("NO"); } } }