結果
| 問題 |
No.216 FAC
|
| コンテスト | |
| ユーザー |
fkwnw3_1243
|
| 提出日時 | 2017-04-30 14:57:48 |
| 言語 | Java (openjdk 23) |
| 結果 |
AC
|
| 実行時間 | 54 ms / 1,000 ms |
| コード長 | 1,367 bytes |
| コンパイル時間 | 2,432 ms |
| コンパイル使用メモリ | 77,764 KB |
| 実行使用メモリ | 37,100 KB |
| 最終ジャッジ日時 | 2024-09-13 23:40:01 |
| 合計ジャッジ時間 | 4,894 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 24 |
ソースコード
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import static java.lang.System.in;
public class Main {
public static void main(String[] args) throws IOException {
int numOfParticipants = 100;
int[] pointsOfParticipants = new int[numOfParticipants + 1];
BufferedReader reader = new BufferedReader(new InputStreamReader(in));
int N = Integer.parseInt(reader.readLine());
String[] scores = reader.readLine().split(" ");
String[] solvedByArray = reader.readLine().split(" ");
for (int i = 0; i < N; i++) {
int solvedBy = Integer.parseInt(solvedByArray[i]);
int score = Integer.parseInt(scores[i]);
if (solvedBy == 0) {
pointsOfParticipants[100] += score;
} else {
pointsOfParticipants[solvedBy-1] += score;
}
}
int champion = 0;
int maxSoFar = Integer.MIN_VALUE;
for (int i = 0; i < numOfParticipants+1; i++) {
if (pointsOfParticipants[i] >= maxSoFar) {
maxSoFar = pointsOfParticipants[i];
champion = i;
}
}
if(champion==100) {
System.out.println("YES");
} else {
System.out.println("NO");
}
}
}
fkwnw3_1243