結果
| 問題 |
No.702 中央値を求めよ LIMITED
|
| コンテスト | |
| ユーザー |
AreTrash
|
| 提出日時 | 2018-10-12 10:31:22 |
| 言語 | C#(csc) (csc 3.9.0) |
| 結果 |
AC
|
| 実行時間 | 217 ms / 5,000 ms |
| コード長 | 1,159 bytes |
| コンパイル時間 | 2,016 ms |
| コンパイル使用メモリ | 106,112 KB |
| 実行使用メモリ | 17,920 KB |
| 最終ジャッジ日時 | 2024-11-22 22:45:12 |
| 合計ジャッジ時間 | 9,108 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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.
ソースコード
using System;
using System.Collections.Generic;
namespace No702
{
public class Program
{
public static void Main(string[] args)
{
const int A = 10000001;
const uint Min = 2100000000;
const uint Max = 2200000000;
var seed = uint.Parse(Console.ReadLine());
var xorShift = new XorShift(seed);
var list = new List<uint>(A + 10);
var offset = 0;
for (var i = 0; i < A; i++)
{
var gen = xorShift.Generate();
if (gen < Min) offset++;
if (gen < Min || Max < gen) continue;
list.Add(gen);
}
list.Sort();
Console.WriteLine(list[A / 2 - offset]);
}
}
public class XorShift
{
uint x = 0, y = 1, z = 2, w = 3;
public XorShift(uint seed)
{
x = seed;
}
public uint Generate()
{
var t = x ^ (x << 11);
x = y;
y = z;
z = w;
w = w ^ (w >> 19) ^ t ^ (t >> 8);
return w;
}
}
}
AreTrash