結果

問題 No.216 FAC
ユーザー Subaru314Subaru314
提出日時 2021-05-24 01:07:30
言語 Java21
(openjdk 21)
結果
AC  
実行時間 152 ms / 1,000 ms
コード長 827 bytes
コンパイル時間 2,152 ms
コンパイル使用メモリ 77,188 KB
実行使用メモリ 54,436 KB
最終ジャッジ日時 2024-04-20 10:15:01
合計ジャッジ時間 6,901 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 123 ms
53,852 KB
testcase_01 AC 127 ms
53,992 KB
testcase_02 AC 125 ms
53,852 KB
testcase_03 AC 140 ms
54,096 KB
testcase_04 AC 136 ms
54,120 KB
testcase_05 AC 135 ms
54,124 KB
testcase_06 AC 131 ms
54,168 KB
testcase_07 AC 130 ms
54,144 KB
testcase_08 AC 129 ms
54,296 KB
testcase_09 AC 137 ms
54,248 KB
testcase_10 AC 131 ms
53,932 KB
testcase_11 AC 133 ms
54,436 KB
testcase_12 AC 130 ms
54,392 KB
testcase_13 AC 126 ms
53,968 KB
testcase_14 AC 128 ms
54,108 KB
testcase_15 AC 130 ms
54,040 KB
testcase_16 AC 139 ms
53,900 KB
testcase_17 AC 147 ms
54,108 KB
testcase_18 AC 149 ms
54,244 KB
testcase_19 AC 142 ms
54,184 KB
testcase_20 AC 143 ms
54,300 KB
testcase_21 AC 152 ms
54,008 KB
testcase_22 AC 142 ms
54,072 KB
testcase_23 AC 147 ms
54,244 KB
testcase_24 AC 141 ms
54,004 KB
testcase_25 AC 142 ms
53,996 KB
testcase_26 AC 137 ms
54,068 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int[] pro = new int[n];
    int[] name = new int[n];
    for(int i = 0; i < n; i++){
      pro[i] = sc.nextInt();
    }
    for(int i = 0; i < n; i++){
      name[i] = sc.nextInt();
    }
    int[] point = new int[101];
    for(int i = 0; i < 101; i++){
      point[i] = 0;
    }
    for(int i = 0; i < 101; i++){
      for(int j = 0; j < n; j++){
        if(name[j] == i){
          point[i] = point[i] + pro[j];
        }
      }
    }
    int ans = point[0];
    for(int i = 1; i < 101; i++){
      if(ans<point[i]){
        ans = point[i];
      }
    }
    if(ans==point[0]){
      System.out.println("YES");
    }else{
      System.out.println("NO");
    }
  }
}
0