結果
| 問題 |
No.447 ゆきこーだーの雨と雪 (2)
|
| ユーザー |
|
| 提出日時 | 2017-05-21 16:33:05 |
| 言語 | C#(csc) (csc 3.9.0) |
| 結果 |
AC
|
| 実行時間 | 454 ms / 2,000 ms |
| コード長 | 3,310 bytes |
| コンパイル時間 | 2,002 ms |
| コンパイル使用メモリ | 115,804 KB |
| 実行使用メモリ | 25,600 KB |
| 最終ジャッジ日時 | 2024-09-19 08:08:07 |
| 合計ジャッジ時間 | 8,994 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / 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.IO;
using System.Linq;
public class Program
{
public static void Main() {
var so = new Solver();
so.Solve();
}
}
public class Solver
{
private readonly Reader reader;
private readonly TextWriter writer;
public Solver() {
reader = new Reader(Console.In);
writer = Console.Out;
}
public Solver(string input, string output) {
reader = new Reader(new StreamReader(input));
writer = new StreamWriter(output);
}
public void Solve() {
int N = reader.RInt();
int[] L = reader.RIntArray();
int T = reader.RInt();
var d = new List<KeyValuePair<string, int>>();
for (int i = 0; i < T; i++) {
d.Add(new KeyValuePair<string, int>(reader.RString(), GetQ(reader.String())));
}
var user = new List<User>();
var answer = new List<int>();
foreach (var item in d.Select((x, i) => new { x, i })) {
answer.Add(item.x.Value);
decimal c = (decimal)0.8 + (decimal)0.2 * answer.Count(x => x == item.x.Value);
int b = L[item.x.Value];
var u = user.FirstOrDefault(x => x.name == item.x.Key);
if (u == null) {
u = new User { name = item.x.Key };
user.Add(u);
}
u.point.Add(item.x.Value, 50 * b + (int)(50 * b / c));
u.lastAnswer = item.i;
u.sumPoint = u.point.Select(x => x.Value).Sum();
}
var ans = user.OrderByDescending(x => x.sumPoint).ThenBy(x => x.lastAnswer);
foreach (var item in ans.Select((x, i) => new { x, i })) {
writer.Write(item.i + 1 + " " + item.x.name + " ");
for (int i = 0; i < N; i++) {
int p = item.x.point.FirstOrDefault(x => x.Key == i).Value;
writer.Write(p + " ");
}
writer.WriteLine(item.x.sumPoint);
}
writer.Flush();
}
private int GetQ(string q) {
string s = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
return s.IndexOf(q);
}
private class User
{
public string name;
public Dictionary<int, int> point = new Dictionary<int, int>();
public int sumPoint;
public int lastAnswer;
}
}
public class Reader
{
private readonly TextReader reader;
private readonly char separator = ' ';
private string[] A = new string[0];
private int i;
public Reader(TextReader r) {
reader = r;
}
public string String() { return Set(); }
public int Int() { return int.Parse(Set()); }
public long Long() { return long.Parse(Set()); }
public decimal Decimal() { return decimal.Parse(Set()); }
public string RString() { return RSet(); }
public int RInt() { return int.Parse(RSet()); }
public long RLong() { return long.Parse(RSet()); }
public decimal RDecimal() { return decimal.Parse(RSet()); }
public int[] RIntArray() { Read(); return A.Select(x => int.Parse(x)).ToArray(); }
private void Read() {
string line = reader.ReadLine();
A = line.Split(separator);
i = 0;
}
private string Set() { return A[i++]; }
private string RSet() { Read(); return A[i++]; }
}