結果

問題 No.216 FAC
ユーザー kenji_shioya
提出日時 2016-06-11 07:12:13
言語 Java
(openjdk 23)
結果
AC  
実行時間 154 ms / 1,000 ms
コード長 749 bytes
コンパイル時間 3,559 ms
コンパイル使用メモリ 74,804 KB
実行使用メモリ 41,868 KB
最終ジャッジ日時 2024-10-15 00:59:09
合計ジャッジ時間 8,324 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 24
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Exercise76{
  public static void main (String[] args){

    Scanner sc = new Scanner(System.in);

    int n = sc.nextInt();
    int[] scores = new int[n];
    int[] solved = new int[n];

    int[] pp = new int[101];


    for (int i = 0; i < n; i++){
      scores[i] = sc.nextInt();
    }
    for (int i = 0; i < n; i++){
      solved[i] = sc.nextInt();
    }

    for (int j = 0; j < n; j++){
      pp[solved[j]] += scores[j];
    }

    boolean flag = true;
    for (int j = 1; j < pp.length; j++){
      if (pp[j] == 0){
        continue;
      }
      if (pp[0] < pp[j]){
        flag = false;
      }
    }

    if (flag){
      System.out.println("YES");
    }else{
      System.out.println("NO");
    }
  }
}
0