結果
問題 | No.447 ゆきこーだーの雨と雪 (2) |
ユーザー | uafr_cs |
提出日時 | 2017-10-30 18:56:34 |
言語 | Java21 (openjdk 21) |
結果 |
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 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 140 ms
40,076 KB |
testcase_01 | AC | 155 ms
41,812 KB |
testcase_02 | AC | 150 ms
41,516 KB |
testcase_03 | AC | 326 ms
46,712 KB |
testcase_04 | AC | 315 ms
46,228 KB |
testcase_05 | AC | 439 ms
48,640 KB |
testcase_06 | AC | 652 ms
49,508 KB |
testcase_07 | AC | 442 ms
48,552 KB |
testcase_08 | AC | 491 ms
48,892 KB |
testcase_09 | AC | 574 ms
48,888 KB |
testcase_10 | AC | 333 ms
45,320 KB |
testcase_11 | AC | 359 ms
48,268 KB |
testcase_12 | AC | 402 ms
48,308 KB |
testcase_13 | AC | 532 ms
49,392 KB |
testcase_14 | AC | 569 ms
48,644 KB |
testcase_15 | AC | 366 ms
48,064 KB |
testcase_16 | AC | 362 ms
45,408 KB |
testcase_17 | AC | 366 ms
47,048 KB |
testcase_18 | AC | 271 ms
43,352 KB |
testcase_19 | AC | 754 ms
54,220 KB |
testcase_20 | AC | 621 ms
50,056 KB |
testcase_21 | AC | 405 ms
47,604 KB |
testcase_22 | AC | 336 ms
46,916 KB |
testcase_23 | AC | 409 ms
48,312 KB |
testcase_24 | AC | 637 ms
49,460 KB |
testcase_25 | AC | 735 ms
54,916 KB |
testcase_26 | AC | 493 ms
48,492 KB |
testcase_27 | AC | 459 ms
48,172 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); } } }