結果
| 問題 |
No.447 ゆきこーだーの雨と雪 (2)
|
| コンテスト | |
| ユーザー |
fal_rnd
|
| 提出日時 | 2016-11-19 00:14:16 |
| 言語 | Java (openjdk 23) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,509 bytes |
| コンパイル時間 | 2,210 ms |
| コンパイル使用メモリ | 81,144 KB |
| 実行使用メモリ | 56,088 KB |
| 最終ジャッジ日時 | 2024-11-26 09:06:10 |
| 合計ジャッジ時間 | 18,762 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | WA * 25 |
ソースコード
import java.util.*;
class B{
static Scanner s = new Scanner(System.in);
public static void main(String[] args) {
int[] levels = new int[s.nextInt()],
passed = new int[levels.length];
LinkedList<user> m = new LinkedList<>();
for (int i = 0; i < levels.length; i++) {
levels[i]=s.nextInt();
}
s.next();
while(s.hasNext()) {
String name = s.next();
int no = s.next().charAt(0)-'A';
passed[no]++;
user u = new user(name);
if(m.contains(u)) {
m.add(m.get(m.indexOf(u)).addScore(no, getScore(levels[no], passed[no])));
m.remove(u);
}else {
m.add(new user(name,levels.length).addScore(no, getScore(levels[no], passed[no])));
}
}
Collections.sort(m);
for(int i=0;i<m.size();++i) {
user v = m.get(i);
System.out.printf("%d %s ",i+1,v.name);
for(int sc:v.score) {
System.out.printf("%d ",sc);
}
System.out.printf("%d\n",v.scoreSum);
}
}
static int getScore(int level, int th) {
return level*50+(int)(50.0*level/(0.2*th+0.8));
}
}
class user implements Comparable<user>{
String name;
int[] score;
int scoreSum=0;
public user(String name,int pros) {
this.name=name;
score = new int[pros];
}
public user(String name) {
this(name,1);
}
public user addScore(int no,int score) {
this.score[no]+=score;
scoreSum+=score;
return this;
}
@Override
public boolean equals(Object obj) {
return this.name.equals(((user)obj).name);
}
@Override
public int compareTo(user o) {
return o.scoreSum-this.scoreSum;
}
}
fal_rnd