結果
問題 | No.216 FAC |
ユーザー |
|
提出日時 | 2018-01-22 19:32:14 |
言語 | Java (openjdk 23) |
結果 |
WA
|
実行時間 | - |
コード長 | 874 bytes |
コンパイル時間 | 4,379 ms |
コンパイル使用メモリ | 76,244 KB |
実行使用メモリ | 36,956 KB |
最終ジャッジ日時 | 2024-12-26 01:16:04 |
合計ジャッジ時間 | 7,669 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 20 WA * 4 |
ソースコード
package me.yukicoder.lv1;import java.io.BufferedReader;import java.io.IOException;import java.io.InputStreamReader;public class No0216 {public static void main(String[] args) {try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {int cnt = Integer.parseInt(br.readLine());String[] a = br.readLine().split(" ");String[] b = br.readLine().split(" ");int[] score = new int[100];int scoreK = 0;int max = 0;for (int i = 0; i < cnt; i++) {int tmp = Integer.parseInt(a[i]);int cntSolved = Integer.parseInt(b[i]);if (cntSolved == 0) {scoreK += tmp;} else {score[cntSolved - 1] = tmp;}}for (int i = 0; i < cnt; i++) {max = Math.max(max, score[i]);}System.out.println(max <= scoreK ? "YES" : "NO");} catch (IOException e) {e.printStackTrace();}}}