結果

問題 No.216 FAC
ユーザー kenji_shioyakenji_shioya
提出日時 2016-06-11 07:09:40
言語 Java
(openjdk 23)
結果
WA  
実行時間 -
コード長 750 bytes
コンパイル時間 3,412 ms
コンパイル使用メモリ 74,932 KB
実行使用メモリ 55,088 KB
最終ジャッジ日時 2024-10-09 12:49:26
合計ジャッジ時間 8,254 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 17 WA * 7
権限があれば一括ダウンロードができます

ソースコード

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 = false;
    for (int j = 1; j < pp.length; j++){
      if (pp[j] == 0){
        continue;
      }
      if (pp[0] >= pp[j]){
        flag = true;
      }
    }

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