結果
問題 | No.447 ゆきこーだーの雨と雪 (2) |
ユーザー | りあん |
提出日時 | 2016-02-19 01:36:01 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
AC
|
実行時間 | 154 ms / 2,000 ms |
コード長 | 2,853 bytes |
コンパイル時間 | 2,516 ms |
コンパイル使用メモリ | 108,800 KB |
実行使用メモリ | 25,856 KB |
最終ジャッジ日時 | 2024-11-26 01:51:58 |
合計ジャッジ時間 | 6,537 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 25 |
コンパイルメッセージ
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; using System.IO; using System.IO.Compression; using System.Text; namespace Solver { class contestant : IComparable { static int n; static int[] lev; static int[] counts; public string name; public int[] score; public int sum = 0; int lastsubmit; public contestant(int _n, int[] _lev) { n = _n; lev = _lev; counts = new int[n]; } public contestant(string name) { this.name = name; score = new int[n]; } public void submit(char c, int t) { int p = c - 'A'; score[p] = lev[p] * 50 + (int)(lev[p] * 50 / (1 + 0.2 * counts[p]) + 1e-9); sum += score[p]; lastsubmit = t; ++counts[p]; } public int CompareTo(object obj) { var anoth = obj as contestant; if (this.sum == anoth.sum) return this.lastsubmit.CompareTo(anoth.lastsubmit); return anoth.sum.CompareTo(this.sum); } } class Program { static void Main() { var sw = new System.IO.StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false }; var sc = new Scan(); int n = sc.Int; var lev = sc.IntArr; var init = new contestant(n, lev); var id = new SortedDictionary<string, int>(); var lis = new List<contestant>(); int t = sc.Int; for (int i = 0; i < t; i++) { var np = sc.StrArr; if (!id.ContainsKey(np[0])) { id.Add(np[0], lis.Count); lis.Add(new contestant(np[0])); } lis[id[np[0]]].submit(np[1][0], i); } lis.Sort(); for (int i = 0; i < lis.Count; i++) sw.WriteLine((i + 1) + " " + lis[i].name + " " + string.Join(" ", lis[i].score) + " " + lis[i].sum); sw.Flush(); } } class Scan { public int Int { get { return int.Parse(Console.ReadLine().Trim()); } } public long Long { get { return long.Parse(Console.ReadLine().Trim()); } } public string Str { get { return Console.ReadLine().Trim(); } } public int[] IntArr { get { return Console.ReadLine().Trim().Split().Select(int.Parse).ToArray(); } } public long[] LongArr { get { return Console.ReadLine().Trim().Split().Select(long.Parse).ToArray(); } } public double[] DoubleArr { get { return Console.ReadLine().Split().Select(double.Parse).ToArray(); } } public string[] StrArr { get { return Console.ReadLine().Trim().Split(); } } } }