結果

問題 No.216 FAC
ユーザー bell
提出日時 2021-03-05 19:47:25
言語 Java
(openjdk 23)
結果
WA  
実行時間 -
コード長 560 bytes
コンパイル時間 2,188 ms
コンパイル使用メモリ 74,092 KB
実行使用メモリ 41,700 KB
最終ジャッジ日時 2024-10-06 22:05:46
合計ジャッジ時間 6,455 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 16 WA * 8
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.HashSet;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int ans = 0, ans2 = 0;
		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();
		if (b[i] != 0) ans += a[i];
		else if (b[i] == 0)  ans2 += a[i];
		}
		if (ans <= ans2) {
			System.out.println("YES");
		} else {
			System.out.println("NO");
		}
		sc.close();
    }
}
0