結果

問題 No.216 FAC
ユーザー TwinkleStar74TwinkleStar74
提出日時 2017-10-03 03:08:04
言語 Java
(openjdk 23)
結果
AC  
実行時間 56 ms / 1,000 ms
コード長 1,094 bytes
コンパイル時間 3,399 ms
コンパイル使用メモリ 77,280 KB
実行使用メモリ 52,140 KB
最終ジャッジ日時 2024-11-15 22:57:23
合計ジャッジ時間 5,606 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 24
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class No216 {
	public static void main(String[] args) {
		try{
			BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
			int N = Integer.parseInt(br.readLine());
			String[] str = br.readLine().split(" ");
			String[] str2 = br.readLine().split(" ");
			int[] player = new int[101];
			sakusei(N,player,str,str2);
			Hantei(player);
			
		}catch(IOException e){
			e.getStackTrace();
		}catch(NumberFormatException e){
			e.getStackTrace();
		}
	}
	
	
	public static void sakusei(int N,int[] x, String[] a, String[] b){
		int[] score= new int[N];
		int[] ansP = new int[N];
		for(int i=0; i < N; i++){
			score[i] = Integer.parseInt(a[i]);
			ansP[i] = Integer.parseInt(b[i]);
			x[ansP[i]] += score[i];
		}
	}
	
	public static int getMax(int[] x){
		int max = 0;
		for(int i=0; i< x.length; i++)
			if(x[i] > max) max = x[i];
		return max;
	}
	
	public static void Hantei(int[] x){
		if(x[0] >= getMax(x)) System.out.println("YES");
		else System.out.println("NO");
	}
}
0