結果

問題 No.216 FAC
ユーザー jimanojimano
提出日時 2018-01-22 19:24:31
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 871 bytes
コンパイル時間 3,727 ms
コンパイル使用メモリ 73,760 KB
実行使用メモリ 51,704 KB
最終ジャッジ日時 2023-08-26 22:07:37
合計ジャッジ時間 5,799 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 43 ms
49,228 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 AC 44 ms
49,120 KB
testcase_04 AC 43 ms
49,372 KB
testcase_05 AC 43 ms
47,236 KB
testcase_06 AC 41 ms
49,184 KB
testcase_07 AC 41 ms
49,144 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 AC 42 ms
49,336 KB
testcase_12 WA -
testcase_13 AC 42 ms
49,112 KB
testcase_14 WA -
testcase_15 AC 44 ms
49,436 KB
testcase_16 AC 44 ms
49,648 KB
testcase_17 AC 42 ms
49,152 KB
testcase_18 WA -
testcase_19 AC 44 ms
49,276 KB
testcase_20 WA -
testcase_21 AC 45 ms
49,184 KB
testcase_22 AC 42 ms
49,240 KB
testcase_23 AC 42 ms
49,140 KB
testcase_24 WA -
testcase_25 AC 42 ms
47,332 KB
testcase_26 WA -
権限があれば一括ダウンロードができます

ソースコード

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[cnt];
			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 += score[i];
				}
				else {
					score[i] = 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();
		}
	}
}
0