結果
| 問題 | No.702 中央値を求めよ LIMITED | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2018-06-16 00:49:59 | 
| 言語 | Java (openjdk 23) | 
| 結果 | 
                                MLE
                                 
                             | 
| 実行時間 | - | 
| コード長 | 1,296 bytes | 
| コンパイル時間 | 2,107 ms | 
| コンパイル使用メモリ | 77,656 KB | 
| 実行使用メモリ | 61,628 KB | 
| 最終ジャッジ日時 | 2024-06-30 15:49:13 | 
| 合計ジャッジ時間 | 13,943 ms | 
| ジャッジサーバーID (参考情報) | judge5 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | MLE * 2 | 
| other | -- * 25 | 
ソースコード
import java.io.FileNotFoundException;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Scanner;
public class Main {
	public static void main(String[] args) throws FileNotFoundException {
		new Main().run();
	}
	String s = "abcdefghijklmnopqrstuvwxyz";
	void run() throws FileNotFoundException {
		Scanner sc = new Scanner(System.in);
		seed = sc.nextInt();
		long gt = -1, el = Integer.MAX_VALUE;
		while (true) {
			int m = (int) ((gt + el) / 2);
			initialize();
			for (int i = 0; i < 10000001; ++i) {
				generate();
				if (w < m)
					++c1;
				else if (w == m)
					++c2;
				else
					++c3;
			}
			if (c1 + c2 >= 5000001) {
				el = m;
			} else {
				gt = m;
			}
			if (c1 + c2 >= 5000001 && c2 + c3 >= 5000001) {
				System.out.println(m);
				return;
			}
		}
	}
	long c1 = 0, c2 = 0, c3 = 0;
	long x = 0, y = 1, z = 2, w = 3;
	long seed;
	void initialize() {
		x = 0;
		x = seed;
		y = 1;
		z = 2;
		w = 3;
		c1 = 0;
		c2 = 0;
		c3 = 0;
	}
	long generate() {
		long t = (x ^ (x << 11)) & ((1L << 32) - 1);
		x = y & ((1L << 32) - 1);
		y = z & ((1L << 32) - 1);
		z = w & ((1L << 32) - 1);
		w = (w ^ (w >> 19)) ^ (t ^ (t >> 8)) & ((1L << 32) - 1);
		return w;
	}
	void tr(Object... objects) {
		System.out.println(Arrays.deepToString(objects));
	}
}
            
            
            
        