結果
問題 | No.216 FAC |
ユーザー |
![]() |
提出日時 | 2015-08-18 08:20:23 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 140 ms / 1,000 ms |
コード長 | 905 bytes |
コンパイル時間 | 3,382 ms |
コンパイル使用メモリ | 74,580 KB |
実行使用メモリ | 41,736 KB |
最終ジャッジ日時 | 2024-10-15 00:41:23 |
合計ジャッジ時間 | 7,387 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 24 |
ソースコード
import java.util.Scanner;public class No216 {public static void main(String[] args) {Scanner sc = new Scanner(System.in);int kScore = 0;int n = sc.nextInt();int[] score = new int[n];int[] answer = new int[100];// スコア一覧を配列に格納for(int i = 0; i < n; i++){score[i] = sc.nextInt();}// 解答者に得点を追加for(int i = 0; i < n; i++){int kaitou = sc.nextInt();if(kaitou != 0){// 解答者がいる場合kaitou--;answer[kaitou] += score[i];}else{// 解答者がいない場合kScore += score[i];}}sc.close();// k君以外の解答者で最高得点のものを検索int max = 0;for(int i = 0; i < 100; i++){if(answer[i] > max){max = answer[i];}}// 優勝できるか判定if(kScore >= max){System.out.println("YES");}else{System.out.println("NO");}}}