結果

問題 No.447 ゆきこーだーの雨と雪 (2)
ユーザー くれちーくれちー
提出日時 2016-11-19 15:53:46
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 431 ms / 2,000 ms
コード長 3,220 bytes
コンパイル時間 2,450 ms
コンパイル使用メモリ 107,896 KB
実行使用メモリ 27,572 KB
最終ジャッジ日時 2023-08-17 21:23:25
合計ジャッジ時間 9,369 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 63 ms
22,696 KB
testcase_01 AC 63 ms
20,744 KB
testcase_02 AC 61 ms
20,680 KB
testcase_03 AC 86 ms
20,792 KB
testcase_04 AC 84 ms
22,652 KB
testcase_05 AC 268 ms
20,660 KB
testcase_06 AC 338 ms
25,460 KB
testcase_07 AC 163 ms
22,616 KB
testcase_08 AC 192 ms
22,612 KB
testcase_09 AC 357 ms
22,612 KB
testcase_10 AC 84 ms
20,740 KB
testcase_11 AC 98 ms
20,664 KB
testcase_12 AC 127 ms
20,740 KB
testcase_13 AC 295 ms
22,704 KB
testcase_14 AC 401 ms
24,824 KB
testcase_15 AC 105 ms
20,636 KB
testcase_16 AC 101 ms
22,712 KB
testcase_17 AC 92 ms
20,744 KB
testcase_18 AC 72 ms
20,672 KB
testcase_19 AC 431 ms
25,700 KB
testcase_20 AC 419 ms
25,476 KB
testcase_21 AC 111 ms
20,656 KB
testcase_22 AC 98 ms
20,532 KB
testcase_23 AC 122 ms
20,664 KB
testcase_24 AC 285 ms
25,240 KB
testcase_25 AC 380 ms
27,572 KB
testcase_26 AC 170 ms
24,748 KB
testcase_27 AC 156 ms
24,820 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
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;

class Problem
{
    public char Name { get; set; }
    public int Level { get; set; }
    public int Solve { get; set; } = 0;

    public Problem(int level)
    {
        Level = level;
    }

    public static int GetId(char name)
    {
        return name - 'A';
    }
}

class Submit
{
    public string Name { get; set; }
    public char ProblemName { get; set; }

    public Submit(string name, char problemName)
    {
        Name = name;
        ProblemName = problemName;
    }
}

class Participant : IEquatable<Participant>, IComparable<Participant>
{
    public string Name { get; set; }
    public List<int> Score { get; set; }
    public int ScoreSum { get; set; } = 0;
    public int LastSubmit { get; set; }

    public Participant(string name)
    {
        Name = name;
    }
    public Participant(string name, int problemNum, int lastSubmit)
    {
        Name = name;
        Score = new List<int>();
        for (int i = 0; i < problemNum; i++) Score.Add(0);
        LastSubmit = lastSubmit;
    }

    bool IEquatable<Participant>.Equals(Participant p)
    {
        if (p == null) return false;
        else return (Name == p.Name);
    }

    public int CompareTo(Participant p)
    {
        if (ScoreSum.CompareTo(p.ScoreSum) == 0)
            return LastSubmit.CompareTo(p.LastSubmit);
        else
            return p.ScoreSum.CompareTo(ScoreSum);
    }

    public void Solve(int no, int level, int rank)
    {
        Score[no] = 50 * level + (500 * level / (8 + 2 * rank));
        ScoreSum += Score[no];
    }
}

class Program
{
    static void Main()
    {
        int N = int.Parse(Console.ReadLine());
        var problemList = new List<Problem>(N);

        string[] strtmp = Console.ReadLine().Split(' ');
        for (int i = 0; i < N; i++)
            problemList.Add(new Problem(int.Parse(strtmp[i])));

        int T = int.Parse(Console.ReadLine());
        var submitList = new List<Submit>(T);
        var participantList = new List<Participant>();

        for (int i = 0; i < T; i++)
        {
            strtmp = Console.ReadLine().Split(' ');
            submitList.Add(new Submit(strtmp[0], char.Parse(strtmp[1])));

            if (!participantList.Contains(new Participant(submitList[i].Name)))
                participantList.Add(new Participant(submitList[i].Name, N, i));

            int tmpProblemNo =
                Problem.GetId(submitList[i].ProblemName);
            int tmpParticipantNo =
                participantList.IndexOf(new Participant(submitList[i].Name));

            problemList[tmpProblemNo].Solve++;
            participantList[tmpParticipantNo].Solve(
                tmpProblemNo, problemList[tmpProblemNo].Level, problemList[tmpProblemNo].Solve);
            participantList[tmpParticipantNo].LastSubmit = i;
        }

        participantList.Sort();
        for (int i = 0; i < participantList.Count; i++)
        {
            Console.Write((i + 1) + " " + participantList[i].Name + " ");
            for (int j = 0; j < problemList.Count; j++)
                Console.Write(participantList[i].Score[j] + " ");
            Console.WriteLine(participantList[i].ScoreSum);
        }
    }
}
0