結果

問題 No.216 FAC
ユーザー jimanojimano
提出日時 2018-01-22 19:36:15
言語 Java
(openjdk 23)
結果
AC  
実行時間 59 ms / 1,000 ms
コード長 875 bytes
コンパイル時間 4,144 ms
コンパイル使用メモリ 76,568 KB
実行使用メモリ 36,936 KB
最終ジャッジ日時 2024-12-26 01:18:09
合計ジャッジ時間 6,761 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 24
権限があれば一括ダウンロードができます

ソースコード

diff #

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 < 100; i++) {
				max = Math.max(max, score[i]);
			}
			System.out.println(max <= scoreK ? "YES" : "NO");

		} catch (IOException e) {
			e.printStackTrace();
		}
	}
}
0