結果
| 問題 |
No.447 ゆきこーだーの雨と雪 (2)
|
| ユーザー |
uafr_cs
|
| 提出日時 | 2017-10-30 18:56:34 |
| 言語 | Java (openjdk 23) |
| 結果 |
AC
|
| 実行時間 | 754 ms / 2,000 ms |
| コード長 | 2,093 bytes |
| コンパイル時間 | 2,861 ms |
| コンパイル使用メモリ | 85,016 KB |
| 実行使用メモリ | 54,916 KB |
| 最終ジャッジ日時 | 2024-11-22 10:50:26 |
| 合計ジャッジ時間 | 17,317 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 25 |
ソースコード
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.Scanner;
public class Main {
public static class Person implements Comparable<Person> {
String name;
long[] scores;
long sum_score;
int latest;
public Person(String name, int N){
this.name = name;
this.scores = new long[N];
this.sum_score = 0;
this.latest = -1;
}
public int compareTo(Person arg0){
if(Long.compare(this.sum_score, arg0.sum_score) != 0){
return -Long.compare(this.sum_score, arg0.sum_score);
}else{
return Integer.compare(this.latest, arg0.latest);
}
}
}
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
final int N = sc.nextInt();
long[] solve_rate = new long[N];
for(int i = 0; i < N; i++){
solve_rate[i] = sc.nextLong();
}
final int T = sc.nextInt();
String[] names = new String[T];
int[] ps = new int[T];
for(int i = 0; i < T; i++){
final String name = sc.next();
final int pid = sc.next().charAt(0) - 'A';
names[i] = name;
ps[i] = pid;
}
HashMap<String, Person> map = new HashMap<String, Person>();
for(int t = 0; t < T; t++){
if(map.containsKey(names[t])){ continue; }
map.put(names[t], new Person(names[t], N));
}
int[] solve_count = new int[N];
for(int t = 0; t < T; t++){
final String name = names[t];
final int pid = ps[t];
solve_count[pid]++;
final long curr_score = 50 * solve_rate[pid] + (500 * solve_rate[pid] / (8 + 2 * solve_count[pid]));
map.get(name).scores[pid] = curr_score;
map.get(name).sum_score += curr_score;
map.get(name).latest = t;
}
ArrayList<Person> people = new ArrayList<Person>(map.values());
Collections.sort(people);
for(int i = 0; i < people.size(); i++){
System.out.print((i + 1));
System.out.print(" " + people.get(i).name);
for(int j = 0; j < N; j++){
System.out.print(" " + people.get(i).scores[j]);
}
System.out.println(" " + people.get(i).sum_score);
}
}
}
uafr_cs