結果

問題 No.702 中央値を求めよ LIMITED
コンテスト
ユーザー 👑 kakel-san
提出日時 2026-10-18 17:23:30
言語 C#(csc)
(csc 3.9.0)
コンパイル:
csc -langversion:latest -unsafe -warn:0 -o+ /r:System.Numerics.dll _filename_ -out:a.exe
実行:
/usr/bin/mono a.exe
結果
AC  
実行時間 1,883 ms / 5,000 ms
+ 732µs
コード長 954 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 1,897 ms
コンパイル使用メモリ 110,264 KB
実行使用メモリ 26,316 KB
最終ジャッジ日時 2026-10-18 17:24:31
合計ジャッジ時間 57,239 ms
ジャッジサーバーID
(参考情報)
judge6_0 / judge2_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 25
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #
raw source code

using System;
using static System.Console;

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;
            x = s;
            y = 1;
            z = 2;
            w = 3;
            var count = 0;
            for (var i = 0; i < n; ++i)
            {
                uint t = x ^ (x << 11);
                x = y;
                y = z;
                z = w;
                w = w ^ (w >> 19) ^ t ^ (t >> 8);
                if (w <= mid) ++count;
            }
            if (n / 2 < count) ok = mid;
            else ng = mid;
        }
        WriteLine(ok);
    }
    static uint x = 0;
    static uint y = 1;
    static uint z = 2;
    static uint w = 3;
}
0