結果

問題 No.702 中央値を求めよ LIMITED
コンテスト
ユーザー 👑 kakel-san
提出日時 2026-10-18 17:15:18
言語 C#
(.NET 10.0.402 + ACL)
コンパイル:
dotnet_c
実行:
/usr/bin/dotnet_wrap
結果
MLE  
実行時間 -
コード長 1,158 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 9,403 ms
コンパイル使用メモリ 173,140 KB
実行使用メモリ 32,776 KB
最終ジャッジ日時 2026-10-18 17:16:38
合計ジャッジ時間 79,077 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge6_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample MLE * 2
other MLE * 25
権限があれば一括ダウンロードができます
コンパイルメッセージ
  復元対象のプロジェクトを決定しています...
  /home/judge/data/code/main.csproj を復元しました (243 ミリ秒)。
  main -> /home/judge/data/code/bin/Release/net10.0/main.dll
  main -> /home/judge/data/code/bin/Release/net10.0/publish/

ソースコード

diff #
raw source code

using System;
using static System.Console;
using System.Linq;
using System.Collections.Generic;

class Program
{
    static uint NN => uint.Parse(ReadLine());
    public static void Main()
    {
        Solve();
    }
    static void Solve()
    {
        var s = NN;
        var n = 10_000_001;
        var ok = 3_000_000_000L;
        var ng = 1_000_000_000L;
        while (ok - ng > 1)
        {
            var mid = (ok + ng) / 2;
            Init(s);
            var count = 0;
            for (var i = 0; i < n; ++i)
            {
                var a = Next();
                if (a <= mid) ++count;
            }
            if (n / 2 < count) ok = mid;
            else ng = mid;
        }
        WriteLine(ok);
    }
    static void Init(uint seed)
    {
        x = seed;
        y = 1;
        z = 2;
        w = 3;
    }
    static uint x = 0;
    static uint y = 1;
    static uint z = 2;
    static uint w = 3;
    static uint Next()
    {
        uint t = x ^ (x << 11);
        x = y;
        y = z;
        z = w;
        w = w ^ (w >> 19) ^ t ^ (t >> 8);
        return w;
    }
}
0