結果
問題 | No.447 ゆきこーだーの雨と雪 (2) |
ユーザー | AreTrash |
提出日時 | 2016-12-04 16:31:47 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
AC
|
実行時間 | 62 ms / 2,000 ms |
コード長 | 4,034 bytes |
コンパイル時間 | 2,105 ms |
コンパイル使用メモリ | 111,488 KB |
実行使用メモリ | 26,368 KB |
最終ジャッジ日時 | 2024-11-27 19:44:29 |
合計ジャッジ時間 | 3,280 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 40 ms
20,736 KB |
testcase_01 | AC | 41 ms
20,864 KB |
testcase_02 | AC | 39 ms
20,608 KB |
testcase_03 | AC | 45 ms
21,632 KB |
testcase_04 | AC | 44 ms
21,504 KB |
testcase_05 | AC | 50 ms
22,984 KB |
testcase_06 | AC | 57 ms
24,192 KB |
testcase_07 | AC | 48 ms
22,624 KB |
testcase_08 | AC | 48 ms
22,904 KB |
testcase_09 | AC | 54 ms
24,064 KB |
testcase_10 | AC | 44 ms
21,632 KB |
testcase_11 | AC | 45 ms
21,504 KB |
testcase_12 | AC | 46 ms
21,724 KB |
testcase_13 | AC | 51 ms
23,296 KB |
testcase_14 | AC | 54 ms
24,192 KB |
testcase_15 | AC | 44 ms
22,016 KB |
testcase_16 | AC | 43 ms
21,760 KB |
testcase_17 | AC | 44 ms
21,760 KB |
testcase_18 | AC | 42 ms
21,504 KB |
testcase_19 | AC | 62 ms
26,240 KB |
testcase_20 | AC | 55 ms
24,448 KB |
testcase_21 | AC | 45 ms
21,836 KB |
testcase_22 | AC | 45 ms
21,888 KB |
testcase_23 | AC | 46 ms
22,400 KB |
testcase_24 | AC | 54 ms
23,884 KB |
testcase_25 | AC | 60 ms
26,368 KB |
testcase_26 | AC | 48 ms
22,488 KB |
testcase_27 | AC | 49 ms
22,760 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 _lastAc; 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, _lastAc++); } public string[] Result(){ return _contestants .OrderByDescending(con => con.Value.Sum()) .ThenBy(con => con.Value.LastAc) .Select((contestant, idx) => $"{idx + 1} {contestant.Key} {contestant.Value.Result()} {contestant.Value.Sum()}") .ToArray(); } } public class Contestant{ private readonly int[] _points; public int LastAc { private set; get; } public Contestant(int cnt){ _points = new int[cnt]; } public void Solve(int num, int point, int count){ _points[num] = point; LastAc = 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; } } }