結果
| 問題 |
No.702 中央値を求めよ LIMITED
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-03-24 03:05:13 |
| 言語 | Java (openjdk 23) |
| 結果 |
MLE
|
| 実行時間 | - |
| コード長 | 1,285 bytes |
| コンパイル時間 | 4,540 ms |
| コンパイル使用メモリ | 83,304 KB |
| 実行使用メモリ | 41,792 KB |
| 最終ジャッジ日時 | 2024-12-30 08:32:09 |
| 合計ジャッジ時間 | 86,828 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | MLE * 2 |
| other | MLE * 25 |
ソースコード
package yukicoder;
import java.util.Arrays;
import java.util.Scanner;
public class No702 {
Scanner in;
String INPUT = "";
void solve()
{
int seed = ni();
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);
}
long x = 0, y = 1, z = 2, w = 3;
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;
}
void run() throws Exception
{
in = oj ? new Scanner(System.in) : new Scanner(INPUT);
long s = System.currentTimeMillis();
solve();
tr(System.currentTimeMillis()-s+"ms");
}
public static void main(String[] args) throws Exception
{
new No702().run();
}
int ni() { return Integer.parseInt(in.next()); }
long nl() { return Long.parseLong(in.next()); }
double nd() { return Double.parseDouble(in.next()); }
boolean oj = System.getProperty("ONLINE_JUDGE") != null;
void tr(Object... o) { if(!oj)System.out.println(Arrays.deepToString(o)); }
}