結果
問題 | No.447 ゆきこーだーの雨と雪 (2) |
ユーザー | uafr_cs |
提出日時 | 2017-10-30 18:56:34 |
言語 | Java21 (openjdk 21) |
結果 |
AC
|
実行時間 | 729 ms / 2,000 ms |
コード長 | 2,093 bytes |
コンパイル時間 | 3,078 ms |
コンパイル使用メモリ | 83,428 KB |
実行使用メモリ | 62,240 KB |
最終ジャッジ日時 | 2023-08-14 13:16:50 |
合計ジャッジ時間 | 16,881 ms |
ジャッジサーバーID (参考情報) |
judge15 / judge12 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 143 ms
55,916 KB |
testcase_01 | AC | 142 ms
56,372 KB |
testcase_02 | AC | 144 ms
55,892 KB |
testcase_03 | AC | 296 ms
61,356 KB |
testcase_04 | AC | 281 ms
61,172 KB |
testcase_05 | AC | 409 ms
61,464 KB |
testcase_06 | AC | 644 ms
61,660 KB |
testcase_07 | AC | 408 ms
61,316 KB |
testcase_08 | AC | 472 ms
61,372 KB |
testcase_09 | AC | 561 ms
61,660 KB |
testcase_10 | AC | 317 ms
61,060 KB |
testcase_11 | AC | 331 ms
61,252 KB |
testcase_12 | AC | 396 ms
61,300 KB |
testcase_13 | AC | 496 ms
61,088 KB |
testcase_14 | AC | 551 ms
62,152 KB |
testcase_15 | AC | 355 ms
61,772 KB |
testcase_16 | AC | 357 ms
59,292 KB |
testcase_17 | AC | 314 ms
61,304 KB |
testcase_18 | AC | 267 ms
57,328 KB |
testcase_19 | AC | 729 ms
62,240 KB |
testcase_20 | AC | 595 ms
62,004 KB |
testcase_21 | AC | 376 ms
61,956 KB |
testcase_22 | AC | 313 ms
60,948 KB |
testcase_23 | AC | 380 ms
59,380 KB |
testcase_24 | AC | 594 ms
61,452 KB |
testcase_25 | AC | 678 ms
61,932 KB |
testcase_26 | AC | 454 ms
61,800 KB |
testcase_27 | AC | 422 ms
61,320 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); } } }