結果
問題 | No.447 ゆきこーだーの雨と雪 (2) |
ユーザー | mban |
提出日時 | 2017-01-09 19:30:57 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
AC
|
実行時間 | 118 ms / 2,000 ms |
コード長 | 3,740 bytes |
コンパイル時間 | 2,229 ms |
コンパイル使用メモリ | 116,064 KB |
実行使用メモリ | 25,856 KB |
最終ジャッジ日時 | 2024-05-10 03:28:14 |
合計ジャッジ時間 | 5,237 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 39 ms
20,096 KB |
testcase_01 | AC | 37 ms
20,352 KB |
testcase_02 | AC | 37 ms
20,608 KB |
testcase_03 | AC | 47 ms
21,888 KB |
testcase_04 | AC | 45 ms
21,504 KB |
testcase_05 | AC | 83 ms
25,728 KB |
testcase_06 | AC | 102 ms
25,600 KB |
testcase_07 | AC | 63 ms
23,808 KB |
testcase_08 | AC | 75 ms
24,320 KB |
testcase_09 | AC | 101 ms
25,812 KB |
testcase_10 | AC | 47 ms
21,248 KB |
testcase_11 | AC | 49 ms
22,016 KB |
testcase_12 | AC | 60 ms
23,040 KB |
testcase_13 | AC | 92 ms
25,388 KB |
testcase_14 | AC | 105 ms
25,564 KB |
testcase_15 | AC | 50 ms
22,272 KB |
testcase_16 | AC | 52 ms
22,144 KB |
testcase_17 | AC | 48 ms
21,888 KB |
testcase_18 | AC | 43 ms
21,376 KB |
testcase_19 | AC | 118 ms
25,856 KB |
testcase_20 | AC | 110 ms
25,544 KB |
testcase_21 | AC | 54 ms
22,528 KB |
testcase_22 | AC | 50 ms
22,016 KB |
testcase_23 | AC | 54 ms
22,656 KB |
testcase_24 | AC | 92 ms
25,460 KB |
testcase_25 | AC | 112 ms
25,856 KB |
testcase_26 | AC | 64 ms
23,552 KB |
testcase_27 | AC | 60 ms
23,424 KB |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
using System; using System.Collections; using System.Collections.Generic; using System.Collections.Specialized; using System.Text; using System.Text.RegularExpressions; using System.Linq; class Magatro { static int N; static int[] L; static int T; static string[] Name; static int[] P; const string ABC = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; static HashSet<string> Hs = new HashSet<string>(); static void Main() { Scanner sc = new Scanner(); var Last = new Dictionary<string ,int>(); N = sc.NextInt(); L = new int[N]; for (int i = 0; i < N; i++) { L[i] = sc.NextInt(); } T = sc.NextInt(); var D = new Dictionary<string, int>(); for (int i = 0; i < 26; i++) { D[ABC[i].ToString()] = i; } Name = new string[T]; P = new int[T]; for (int i = 0; i < T; i++) { Name[i] = sc.Next(); Hs.Add(Name[i]); P[i] = D[sc.Next()]; } foreach(string s in Hs) { Last.Add(s, 0); } for(int i = 0; i < T; i++) { Last[Name[i]] = Math.Max(Last[Name[i]], i); } List<string>[] Li = new List<string>[N]; for(int i = 0; i < N; i++) { Li[i] = new List<string>(); } for(int i = 0; i < T; i++) { Li[P[i]].Add(Name[i]); } var H = new Dictionary<string, int[]>(); foreach(string s in Hs) { H.Add(s, new int[N]); } for(int i = 0; i < N; i++) { for(int j = 0; j < Li[i].Count; j++) { H[Li[i][j]][i] = Score(j + 1, L[i]); } } SC[] Sc = new SC[Hs.Count]; int ind = 0; foreach(var i in H) { Sc[ind].Name = i.Key; Sc[ind].Score = i.Value.ToArray(); Sc[ind].Last = Last[i.Key]; ind++; } Array.Sort(Sc, compare); int iii = 1; foreach (var s in Sc) { Console.Write("{1} {0} ", s.Name,iii); Console.Write(string.Join(" ",s.Score.Select(ii=>ii.ToString()).ToArray())); Console.Write(" {0}",s.Score.Sum()); Console.WriteLine(); iii++; } //Console.WriteLine(Score(1, 2)); } static int Score(int jun,int star) { return 50 * star + ((500*star) / (8 + 2 * jun)); } static int compare(SC a,SC b) { int res = b.Score.Sum().CompareTo(a.Score.Sum()); if (res == 0) { return a.Last.CompareTo(b.Last); } else { return res; } } } struct SC { public string Name; public int Last; public int[] Score; public SC(string name,int N) { Score = new int[N]; Name = name; Last = -1; } } public class Scanner { private string[] S; private int Index; private char Separator; public Scanner(char separator=' ') { Index = 0; Separator = separator; } public string Next() { string result; if (S == null || Index >= S.Length) { S = Line(); Index = 0; } result = S[Index]; Index++; return result; } private string[] Line() { return Console.ReadLine().Split(Separator); } public int NextInt() { return int.Parse(Next()); } public double NextDouble() { return double.Parse(Next()); } public long NextLong() { return long.Parse(Next()); } }