結果
問題 | No.1708 Quality of Contest |
ユーザー |
![]() |
提出日時 | 2021-10-16 12:39:42 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
RE
|
実行時間 | - |
コード長 | 1,279 bytes |
コンパイル時間 | 3,779 ms |
コンパイル使用メモリ | 114,236 KB |
実行使用メモリ | 69,504 KB |
最終ジャッジ日時 | 2024-09-17 19:22:07 |
合計ジャッジ時間 | 11,864 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 RE * 1 |
other | AC * 23 |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
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);}}