結果

問題 No.447 ゆきこーだーの雨と雪 (2)
ユーザー りあんりあん
提出日時 2016-02-19 01:36:01
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 201 ms / 2,000 ms
コード長 2,853 bytes
コンパイル時間 2,506 ms
コンパイル使用メモリ 107,168 KB
実行使用メモリ 28,800 KB
最終ジャッジ日時 2023-08-17 07:05:56
合計ジャッジ時間 7,644 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 87 ms
22,064 KB
testcase_01 AC 88 ms
24,052 KB
testcase_02 AC 86 ms
26,116 KB
testcase_03 AC 114 ms
24,144 KB
testcase_04 AC 112 ms
26,180 KB
testcase_05 AC 176 ms
26,184 KB
testcase_06 AC 172 ms
28,188 KB
testcase_07 AC 149 ms
26,172 KB
testcase_08 AC 141 ms
24,188 KB
testcase_09 AC 188 ms
24,184 KB
testcase_10 AC 101 ms
24,072 KB
testcase_11 AC 121 ms
24,228 KB
testcase_12 AC 122 ms
24,272 KB
testcase_13 AC 176 ms
26,316 KB
testcase_14 AC 201 ms
26,072 KB
testcase_15 AC 124 ms
24,220 KB
testcase_16 AC 101 ms
24,232 KB
testcase_17 AC 120 ms
22,228 KB
testcase_18 AC 96 ms
24,328 KB
testcase_19 AC 189 ms
28,800 KB
testcase_20 AC 201 ms
26,092 KB
testcase_21 AC 118 ms
26,104 KB
testcase_22 AC 124 ms
26,088 KB
testcase_23 AC 138 ms
26,152 KB
testcase_24 AC 172 ms
26,348 KB
testcase_25 AC 189 ms
28,696 KB
testcase_26 AC 150 ms
24,116 KB
testcase_27 AC 146 ms
24,148 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;
using System.Linq;
using System.IO;
using System.IO.Compression;
using System.Text;

namespace Solver
{
    class contestant : IComparable
    {
        static int n;
        static int[] lev;
        static int[] counts;
        public string name;
        public int[] score;
        public int sum = 0;
        int lastsubmit;
        public contestant(int _n, int[] _lev)
        {
            n = _n;
            lev = _lev;
            counts = new int[n];
        }
        public contestant(string name)
        {
            this.name = name;
            score = new int[n];
        }
        public void submit(char c, int t)
        {
            int p = c - 'A';
            score[p] = lev[p] * 50 + (int)(lev[p] * 50 / (1 + 0.2 * counts[p]) + 1e-9);
            sum += score[p];
            lastsubmit = t;
            ++counts[p];
        }
        public int CompareTo(object obj)
        {
            var anoth = obj as contestant;
            if (this.sum == anoth.sum)
                return this.lastsubmit.CompareTo(anoth.lastsubmit);

            return anoth.sum.CompareTo(this.sum);
        }
    }
    class Program
    {
        static void Main()
        {
            var sw = new System.IO.StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            var sc = new Scan();
            int n = sc.Int;
            var lev = sc.IntArr;
            var init = new contestant(n, lev);
            var id = new SortedDictionary<string, int>();
            var lis = new List<contestant>();
            int t = sc.Int;
            for (int i = 0; i < t; i++)
            {
                var np = sc.StrArr;
                if (!id.ContainsKey(np[0]))
                {
                    id.Add(np[0], lis.Count);
                    lis.Add(new contestant(np[0]));
                }
                lis[id[np[0]]].submit(np[1][0], i);
            }
            lis.Sort();
            for (int i = 0; i < lis.Count; i++)
                sw.WriteLine((i + 1) + " " + lis[i].name + " " + string.Join(" ", lis[i].score) + " " + lis[i].sum);

            sw.Flush();
        }
    }
    class Scan
    {
        public int Int { get { return int.Parse(Console.ReadLine().Trim()); } }
        public long Long { get { return long.Parse(Console.ReadLine().Trim()); } }
        public string Str { get { return Console.ReadLine().Trim(); } }
        public int[] IntArr { get { return Console.ReadLine().Trim().Split().Select(int.Parse).ToArray(); } }
        public long[] LongArr { get { return Console.ReadLine().Trim().Split().Select(long.Parse).ToArray(); } }
        public double[] DoubleArr { get { return Console.ReadLine().Split().Select(double.Parse).ToArray(); } }
        public string[] StrArr { get { return Console.ReadLine().Trim().Split(); } }
    }
}
0