結果

問題 No.1708 Quality of Contest
ユーザー bluemeganebluemegane
提出日時 2021-10-16 12:46:38
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 511 ms / 2,000 ms
コード長 1,313 bytes
コンパイル時間 1,538 ms
コンパイル使用メモリ 112,672 KB
実行使用メモリ 76,964 KB
最終ジャッジ日時 2023-10-17 22:08:12
合計ジャッジ時間 11,902 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 36 ms
25,448 KB
testcase_01 AC 36 ms
25,448 KB
testcase_02 AC 36 ms
25,464 KB
testcase_03 AC 46 ms
28,288 KB
testcase_04 AC 48 ms
28,272 KB
testcase_05 AC 47 ms
26,200 KB
testcase_06 AC 45 ms
26,132 KB
testcase_07 AC 46 ms
26,104 KB
testcase_08 AC 32 ms
25,340 KB
testcase_09 AC 511 ms
76,964 KB
testcase_10 AC 425 ms
52,064 KB
testcase_11 AC 446 ms
51,928 KB
testcase_12 AC 479 ms
59,728 KB
testcase_13 AC 424 ms
50,452 KB
testcase_14 AC 488 ms
59,984 KB
testcase_15 AC 505 ms
65,204 KB
testcase_16 AC 505 ms
64,792 KB
testcase_17 AC 485 ms
61,908 KB
testcase_18 AC 503 ms
62,716 KB
testcase_19 AC 495 ms
63,012 KB
testcase_20 AC 470 ms
56,756 KB
testcase_21 AC 489 ms
61,628 KB
testcase_22 AC 480 ms
60,492 KB
testcase_23 AC 501 ms
64,232 KB
testcase_24 AC 397 ms
50,796 KB
testcase_25 AC 396 ms
50,752 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);
        var t = new long[n + 1];
        for (int i = 1; i <= n; i++) t[i] = t[i - 1] + 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 += t[y];
        Console.WriteLine(ans);
    }
}
0