結果

問題 No.447 ゆきこーだーの雨と雪 (2)
ユーザー qazqaz
提出日時 2017-05-21 16:28:40
言語 C#(csc)
(csc 3.9.0)
結果
WA  
実行時間 -
コード長 3,291 bytes
コンパイル時間 4,223 ms
コンパイル使用メモリ 116,076 KB
実行使用メモリ 31,784 KB
最終ジャッジ日時 2023-10-19 12:02:46
合計ジャッジ時間 12,047 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 47 ms
26,708 KB
testcase_01 AC 46 ms
26,708 KB
testcase_02 AC 46 ms
26,604 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

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);
            double c = 0.8 + 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++]; }
}
0