結果
問題 | No.447 ゆきこーだーの雨と雪 (2) |
ユーザー | AreTrash |
提出日時 | 2016-12-04 15:53:20 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
AC
|
実行時間 | 56 ms / 2,000 ms |
コード長 | 4,060 bytes |
コンパイル時間 | 2,566 ms |
コンパイル使用メモリ | 111,872 KB |
実行使用メモリ | 26,368 KB |
最終ジャッジ日時 | 2024-11-27 19:44:20 |
合計ジャッジ時間 | 4,735 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 35 ms
20,736 KB |
testcase_01 | AC | 34 ms
20,864 KB |
testcase_02 | AC | 33 ms
20,992 KB |
testcase_03 | AC | 37 ms
21,632 KB |
testcase_04 | AC | 38 ms
21,760 KB |
testcase_05 | AC | 45 ms
22,912 KB |
testcase_06 | AC | 50 ms
24,576 KB |
testcase_07 | AC | 43 ms
22,872 KB |
testcase_08 | AC | 44 ms
23,172 KB |
testcase_09 | AC | 49 ms
23,936 KB |
testcase_10 | AC | 38 ms
21,760 KB |
testcase_11 | AC | 39 ms
22,144 KB |
testcase_12 | AC | 41 ms
21,984 KB |
testcase_13 | AC | 48 ms
23,168 KB |
testcase_14 | AC | 49 ms
24,320 KB |
testcase_15 | AC | 41 ms
22,144 KB |
testcase_16 | AC | 38 ms
21,760 KB |
testcase_17 | AC | 40 ms
21,760 KB |
testcase_18 | AC | 36 ms
20,992 KB |
testcase_19 | AC | 56 ms
26,368 KB |
testcase_20 | AC | 51 ms
24,512 KB |
testcase_21 | AC | 41 ms
21,836 KB |
testcase_22 | AC | 39 ms
21,504 KB |
testcase_23 | AC | 41 ms
22,272 KB |
testcase_24 | AC | 49 ms
24,264 KB |
testcase_25 | AC | 56 ms
26,240 KB |
testcase_26 | AC | 44 ms
23,000 KB |
testcase_27 | AC | 42 ms
22,744 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.Generic; using System.Linq; namespace No447{ public class Program{ public static void Main(string[] args){ var sr = new StreamReader(); //--------------------------------- var N = sr.Next<int>(); var L = sr.Next<int>(N); var T = sr.Next<int>(); var contest = new Contest(L); for(var i = 0; i < T; i++){ var name = sr.Next<string>(); var number = sr.Next<string>(); contest.Solve(name, number); } Console.WriteLine(string.Join("\n", contest.Result())); //--------------------------------- } } public class Contest{ private readonly List<Problem> _problems = new List<Problem>(); private readonly Dictionary<string, Contestant> _contestants = new Dictionary<string, Contestant>(); private int _count; public Contest(int[] levels){ Array.ForEach(levels, l => _problems.Add(new Problem(l))); } public void Solve(string name, string number){ if(!_contestants.ContainsKey(name)){ _contestants.Add(name, new Contestant(_problems.Count)); } var solver = _contestants[name]; var num = number[0] - 'A'; var point = _problems[num].Solve(solver); solver.Solve(num, point, _count++); } public string[] Result(){ return _contestants .OrderByDescending(con => con.Value.Sum()) .ThenBy(con => con.Value.Count) .Select((contestant, idx) => $"{idx + 1} {contestant.Key} {contestant.Value.Result()} {contestant.Value.Sum()}") .ToArray(); } } public class Contestant{ private readonly int[] _points; public int Count { private set; get; } public Contestant(int cnt){ _points = new int[cnt]; } public void Solve(int num, int point, int count){ _points[num] = point; Count = count; } public int Sum(){ return _points.Sum(); } public string Result(){ return string.Join(" ", _points); } } public class Problem{ private readonly HashSet<Contestant> _solver = new HashSet<Contestant>(); private readonly int _level; public Problem(int level){ _level = level; } public int Solve(Contestant contestant){ _solver.Add(contestant); return (int)Math.Floor(50 * _level + 50 * _level / (0.8 + 0.2 * _solver.Count)); } } public class StreamReader{ private readonly char[] _c = {' '}; private int _index = -1; private string[] _input = new string[0]; private readonly System.IO.StreamReader _sr = new System.IO.StreamReader(Console.OpenStandardInput()); public T Next<T>(){ if(_index == _input.Length - 1){ _index = -1; while(true){ string rl = _sr.ReadLine(); if(rl == null){ if(typeof(T).IsClass) return default(T); return (T)typeof(T).GetField("MinValue").GetValue(null); } if(rl != ""){ _input = rl.Split(_c, StringSplitOptions.RemoveEmptyEntries); break; } } } return (T)Convert.ChangeType(_input[++_index], typeof(T), System.Globalization.CultureInfo.InvariantCulture); } public T[] Next<T>(int x){ var ret = new T[x]; for(var i = 0; i < x; ++i) ret[i] = Next<T>(); return ret; } public T[][] Next<T>(int y, int x){ var ret = new T[y][]; for(var i = 0; i < y; ++i) ret[i] = Next<T>(x); return ret; } } }