結果

問題 No.447 ゆきこーだーの雨と雪 (2)
ユーザー bluemeganebluemegane
提出日時 2018-09-15 20:26:54
言語 C#(csc)
(csc 3.9.0)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 1,975 bytes
コンパイル時間 2,379 ms
コンパイル使用メモリ 111,260 KB
実行使用メモリ 27,628 KB
最終ジャッジ日時 2023-09-25 08:46:13
合計ジャッジ時間 6,227 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
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.Collections.Generic;
using System.Linq;
using System;
using System.IO;
using System.Text;

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;
        var str = new StringBuilder();
        foreach (var x in d.OrderByDescending(y => y.Value.stotal).ThenBy(y => y.Value.actime))
        {
            str.Append ( string.Format("{0} {1} ", p++, x.Key) + string.Join(" ", x.Value.score) + string.Format(" {0}\n", x.Value.stotal));
        }
        Console.WriteLine(str);
        Console.Out.Flush();
    }
    public static int getScore (int[] ac, int[] L , int qno) => 250 * L[qno] / (4 + ac[qno]) + 50 * L[qno];
}
0