結果
| 問題 | 
                            No.216 FAC
                             | 
                    
| コンテスト | |
| ユーザー | 
                             Tsukasa_Type
                         | 
                    
| 提出日時 | 2018-02-10 22:41:19 | 
| 言語 | Java  (openjdk 23)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 632 bytes | 
| コンパイル時間 | 2,896 ms | 
| コンパイル使用メモリ | 74,928 KB | 
| 実行使用メモリ | 55,744 KB | 
| 最終ジャッジ日時 | 2024-11-06 13:17:53 | 
| 合計ジャッジ時間 | 8,086 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge5 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 2 WA * 1 | 
| other | AC * 8 WA * 1 RE * 15 | 
ソースコード
import java.util.*;
public class Main {
	static Scanner sc = new Scanner(System.in);
	public static void main(String[] args) {
		int n = sc.nextInt();
		int[] score = new int[n];
		for (int i=0; i<n; i++) {
			score[i] = sc.nextInt();
		}
		int[] num = new int[n];
		int[] got_score = new int[n];
		for (int i=0; i<n; i++) {
			num[i] = sc.nextInt();
			got_score[num[i]] += score[i];
		}
		
		int myscore = got_score[0]; //主人公のスコアを避難させる
		got_score[0] = 0; //主人公のスコアを消して……
		Arrays.sort(got_score); //ソート。
		
		System.out.println(myscore>got_score[n-1]?"YES":"NO");
	}
}
            
            
            
        
            
Tsukasa_Type