結果
| 問題 |
No.216 FAC
|
| コンテスト | |
| ユーザー |
4A9GN
|
| 提出日時 | 2016-07-21 22:22:52 |
| 言語 | Java (openjdk 23) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 1,352 bytes |
| コンパイル時間 | 2,440 ms |
| コンパイル使用メモリ | 79,240 KB |
| 実行使用メモリ | 54,640 KB |
| 最終ジャッジ日時 | 2024-11-06 07:47:34 |
| 合計ジャッジ時間 | 7,604 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 14 WA * 3 RE * 7 |
ソースコード
import java.util.Scanner;
import java.util.ArrayList;
import java.util.Collections;
public class Main {
static public void main(String[] args) {
Scanner sc = new Scanner(System.in);
int size = sc.nextInt();
int emptyScore = 0;
int i;
ArrayList<Integer> scoreList = new ArrayList<Integer>();
for (i = 0; i < size; i++) //各問題の点数記録
scoreList.add(sc.nextInt());
ArrayList<Integer> answerList = new ArrayList<Integer>();
for (i = 0; i < size; i++) //各問題の正答者記録
answerList.add(sc.nextInt());
ArrayList<Integer> peopleScore = new ArrayList<Integer>(); //出場者番号ごとの点数
for (i = 0; i < size+1; i++)
peopleScore.add(i, 0);
for (i = 0; i < size; i++) {
if (answerList.get(i) >= 1) {
int peopleNum = answerList.get(i);
int peopleSc = peopleScore.get(peopleNum);
int addScore = scoreList.get(i);
peopleScore.add(peopleNum, peopleSc+addScore);
} else emptyScore += scoreList.get(i);
}
Collections.sort(peopleScore);
Collections.reverse(peopleScore);
if (emptyScore >= peopleScore.get(0))
System.out.println("YES");
else
System.out.println("NO");
}
}
4A9GN