結果

問題 No.1708 Quality of Contest
ユーザー bluemeganebluemegane
提出日時 2021-10-16 12:39:42
言語 C#(csc)
(csc 3.9.0)
結果
RE  
実行時間 -
コード長 1,279 bytes
コンパイル時間 5,227 ms
コンパイル使用メモリ 111,892 KB
実行使用メモリ 70,988 KB
最終ジャッジ日時 2023-10-17 22:07:53
合計ジャッジ時間 11,032 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 35 ms
25,596 KB
testcase_01 RE -
testcase_02 AC 35 ms
25,604 KB
testcase_03 AC 47 ms
28,404 KB
testcase_04 AC 47 ms
28,372 KB
testcase_05 AC 47 ms
26,316 KB
testcase_06 AC 45 ms
26,244 KB
testcase_07 AC 45 ms
26,228 KB
testcase_08 AC 33 ms
25,488 KB
testcase_09 AC 494 ms
70,988 KB
testcase_10 AC 425 ms
51,460 KB
testcase_11 AC 452 ms
50,520 KB
testcase_12 AC 463 ms
57,772 KB
testcase_13 AC 438 ms
51,920 KB
testcase_14 AC 472 ms
58,564 KB
testcase_15 AC 497 ms
63,800 KB
testcase_16 AC 503 ms
63,544 KB
testcase_17 AC 490 ms
60,500 KB
testcase_18 AC 474 ms
58,232 KB
testcase_19 AC 503 ms
61,604 KB
testcase_20 AC 477 ms
55,720 KB
testcase_21 AC 501 ms
60,208 KB
testcase_22 AC 477 ms
57,920 KB
testcase_23 AC 504 ms
63,644 KB
testcase_24 AC 395 ms
50,188 KB
testcase_25 AC 395 ms
50,144 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
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;

public class Hello
{
    static void Main()
    {
        string[] line = Console.ReadLine().Trim().Split(' ');
        var n = int.Parse(line[0]);
        var m = int.Parse(line[1]);
        var x = int.Parse(line[2]);
        var d = new Dictionary<int, List<int>>();
        for (int i = 0; i < n; i++)
        {
            line = Console.ReadLine().Trim().Split(' ');
            var a = int.Parse(line[0]);
            var b = int.Parse(line[1]);
            if (!d.ContainsKey(b)) d[b] = new List<int>();
            d[b].Add(a);
        }
        var s = new long[n];
        var p = 0;
        foreach (var y in d)
        {
            var first = true;
            foreach (var z in y.Value.OrderByDescending(z => z))
            {
                if (first) { s[p++] = z + x; first = false; }
                else s[p++] = z;
            }
        }
        Array.Sort(s);
        Array.Reverse(s);
        for (int i = 1; i < n; i++) s[i] = s[i] + s[i - 1];
        Console.ReadLine();
        line = Console.ReadLine().Trim().Split(' ');
        var c = Array.ConvertAll(line, int.Parse);
        var ans = 0L;
        foreach (var y in c) ans += s[y - 1];
        Console.WriteLine(ans);
    }
}
0