結果
| 問題 |
No.447 ゆきこーだーの雨と雪 (2)
|
| コンテスト | |
| ユーザー |
bluemegane
|
| 提出日時 | 2018-09-15 20:16:17 |
| 言語 | C#(csc) (csc 3.9.0) |
| 結果 |
AC
|
| 実行時間 | 50 ms / 2,000 ms |
| コード長 | 1,941 bytes |
| コンパイル時間 | 924 ms |
| コンパイル使用メモリ | 111,852 KB |
| 実行使用メモリ | 29,744 KB |
| 最終ジャッジ日時 | 2024-07-18 07:12:17 |
| 合計ジャッジ時間 | 3,202 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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.Collections.Generic;
using System.Linq;
using System;
using System.IO;
public class P
{
public int[] score { get; set; }
public int stotal { get; set; }
public int actime { get; set; }
}
public class Hello
{
public static void Main()
{
var ac = new int[26];
var n = int.Parse(Console.ReadLine().Trim());
string[] line = Console.ReadLine().Trim().Split(' ');
var L = Array.ConvertAll(line, int.Parse);
var d = new Dictionary<string, P>();
var t = int.Parse(Console.ReadLine().Trim());
for (int i = 0; i < t; i++)
{
string[] s = Console.ReadLine().Trim().Split(' ');
var name = s[0];
var qno = s[1][0] - 'A';
ac[qno]++;
var score = getScore(ac, L, qno);
if (d.ContainsKey(name))
{
d[name].score[qno] = score;
d[name].stotal += score;
d[name].actime = i;
}
else
{
d[name] = new P();
d[name].score = new int[n];
d[name].score[qno] = score;
d[name].stotal = score;
d[name].actime = i;
}
}
print(d, n);
}
public static void print (Dictionary<string,P> d , int n)
{
var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
Console.SetOut(sw);
var p = 1;
foreach (var x in d.OrderByDescending(y => y.Value.stotal).ThenBy(y => y.Value.actime))
{
Console.Write("{0} ", p++);
Console.Write("{0} ", x.Key);
Console.Write(string.Join(" ", x.Value.score));
Console.WriteLine(" {0}", x.Value.stotal);
}
Console.Out.Flush();
}
public static int getScore (int[] ac, int[] L , int qno) => 250 * L[qno] / (4 + ac[qno]) + 50 * L[qno];
}
bluemegane