結果
| 問題 | 
                            No.702 中央値を求めよ LIMITED
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2025-10-04 15:03:42 | 
| 言語 | Java  (openjdk 23)  | 
                    
| 結果 | 
                             
                                MLE
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 764 bytes | 
| コンパイル時間 | 13,235 ms | 
| コンパイル使用メモリ | 85,540 KB | 
| 実行使用メモリ | 47,000 KB | 
| 最終ジャッジ日時 | 2025-10-04 15:05:22 | 
| 合計ジャッジ時間 | 88,031 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge1 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | MLE * 2 | 
| other | MLE * 25 | 
ソースコード
package yukicoder;
import java.util.Scanner;
public class No702 {
	static long x = 0, y = 1, z = 2, w = 3;
	static long generate() { 
	    long t = (x^(x<<11))&(1L<<32)-1;
	    x = y;
	    y = z;
	    z = w;
	    w = ((w ^ (w >> 19)) ^ (t ^ (t >> 8))) & (1L<<32)-1;
	    return w;
	}
	public static void main(String[] args) throws Exception
	{
		Scanner in = new Scanner(System.in);
		int seed = in.nextInt();
		long low = 0, high = 1L<<32;
		while(high - low > 1){
			long h = high+low>>1;
			x = seed;
			y = 1; z = 2; w = 3;
			int bal = 0;
			for(int i = 0;i < 10000001;i++){
				long v = generate();
				if(v <= h){
					bal--;
				}else{
					bal++;
				}
			}
			if(bal < 0){
				high = h;
			}else{
				low = h;
			}
		}
		System.out.println(high);
	}
}