結果
| 問題 | No.3656 Game Scores and Costs |
| コンテスト | |
| ユーザー |
鳩でもわかるC#
|
| 提出日時 | 2026-09-04 22:50:23 |
| 言語 | C# (.NET 10.0.400 + ACL) |
| 結果 |
AC
不安定
|
| 実行時間 | 164 ms / 2,000 ms |
| + 689µs | |
| コード長 | 2,112 bytes |
| 記録 | |
| コンパイル時間 | 14,602 ms |
| コンパイル使用メモリ | 173,712 KB |
| 実行使用メモリ | 226,392 KB |
| 最終ジャッジ日時 | 2026-09-04 23:01:42 |
| 合計ジャッジ時間 | 20,434 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge5_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 21 |
コンパイルメッセージ
復元対象のプロジェクトを決定しています... /home/judge/data/code/main.csproj を復元しました (135 ミリ秒)。 main -> /home/judge/data/code/bin/Release/net10.0/main.dll main -> /home/judge/data/code/bin/Release/net10.0/publish/
ソースコード
using System.Diagnostics;
class Program
{
static string ReadLine() => Console.ReadLine().Trim();
static int ReadInt() => int.Parse(ReadLine());
static long ReadLong() => long.Parse(ReadLine());
static int[] ReadIntArray() { string str = ReadLine(); return str != "" ? str.Split().Select(_ => int.Parse(_)).ToArray() : new int[0]; }
static long[] ReadLongArray() { string str = ReadLine(); return str != "" ? str.Split().Select(_ => long.Parse(_)).ToArray() : new long[0]; }
static (int, int) ReadInt2() { int[] vs = ReadIntArray(); return (vs[0], vs[1]); }
static (int, int, int) ReadInt3() { int[] vs = ReadIntArray(); return (vs[0], vs[1], vs[2]); }
static (int, int, int, int) ReadInt4() { int[] vs = ReadIntArray(); return (vs[0], vs[1], vs[2], vs[3]); }
static (int, int, int, int, int) ReadInt5() { int[] vs = ReadIntArray(); return (vs[0], vs[1], vs[2], vs[3], vs[4]); }
static (long, long) ReadLong2() { long[] vs = ReadLongArray(); return (vs[0], vs[1]); }
static (long, long, long) ReadLong3() { long[] vs = ReadLongArray(); return (vs[0], vs[1], vs[2]); }
static void Main()
{
SourceExpander.Expander.Expand();
(int N, int K, int X) = ReadInt3();
int[] A = ReadIntArray();
PriorityQueue<long, long> pq = new PriorityQueue<long, long>();
long sum = 0;
long ans = long.MinValue;
foreach (var v in A)
{
pq.Enqueue(v, v);
sum += v;
sum -= X;
if (pq.Count > K)
{
var d = pq.Dequeue();
sum -= d;
}
ans = Math.Max(sum, ans);
}
Console.WriteLine(ans);
}
}
#region Expanded by https://github.com/kzrnm/SourceExpander
namespace SourceExpander{public class Expander{[Conditional("EXP")]public static void Expand(string inputFilePath=null,string outputFilePath=null,bool ignoreAnyError=true){}public static string ExpandString(string inputFilePath=null,bool ignoreAnyError=true){return "";}}}
#endregion Expanded by https://github.com/kzrnm/SourceExpander
鳩でもわかるC#