結果
問題 | No.447 ゆきこーだーの雨と雪 (2) |
ユーザー | uafr_cs |
提出日時 | 2017-10-30 18:56:34 |
言語 | Java21 (openjdk 21) |
結果 |
AC
|
実行時間 | 749 ms / 2,000 ms |
コード長 | 2,093 bytes |
コンパイル時間 | 2,923 ms |
コンパイル使用メモリ | 89,872 KB |
実行使用メモリ | 50,644 KB |
最終ジャッジ日時 | 2024-05-02 01:29:09 |
合計ジャッジ時間 | 17,223 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 163 ms
41,596 KB |
testcase_01 | AC | 154 ms
41,328 KB |
testcase_02 | AC | 159 ms
41,392 KB |
testcase_03 | AC | 336 ms
46,732 KB |
testcase_04 | AC | 314 ms
45,984 KB |
testcase_05 | AC | 451 ms
48,576 KB |
testcase_06 | AC | 664 ms
49,256 KB |
testcase_07 | AC | 457 ms
48,228 KB |
testcase_08 | AC | 503 ms
49,148 KB |
testcase_09 | AC | 593 ms
48,936 KB |
testcase_10 | AC | 338 ms
45,596 KB |
testcase_11 | AC | 359 ms
47,980 KB |
testcase_12 | AC | 411 ms
48,300 KB |
testcase_13 | AC | 549 ms
48,792 KB |
testcase_14 | AC | 596 ms
49,548 KB |
testcase_15 | AC | 382 ms
47,544 KB |
testcase_16 | AC | 363 ms
45,512 KB |
testcase_17 | AC | 340 ms
46,736 KB |
testcase_18 | AC | 298 ms
43,040 KB |
testcase_19 | AC | 749 ms
50,644 KB |
testcase_20 | AC | 635 ms
49,812 KB |
testcase_21 | AC | 402 ms
47,900 KB |
testcase_22 | AC | 341 ms
46,600 KB |
testcase_23 | AC | 422 ms
48,304 KB |
testcase_24 | AC | 669 ms
49,252 KB |
testcase_25 | AC | 729 ms
50,388 KB |
testcase_26 | AC | 502 ms
48,240 KB |
testcase_27 | AC | 459 ms
46,972 KB |
ソースコード
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); } } }