結果
| 問題 |
No.702 中央値を求めよ LIMITED
|
| コンテスト | |
| ユーザー |
oshibori
|
| 提出日時 | 2018-06-16 02:18:58 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 748 ms / 5,000 ms |
| コード長 | 1,614 bytes |
| コンパイル時間 | 1,910 ms |
| コンパイル使用メモリ | 166,808 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-11-22 22:26:06 |
| 合計ジャッジ時間 | 23,435 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 25 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
#ifdef _DEBUG
#define _GLIBCXX_DEBUG
#include "dump.hpp"
#else
#define dump(...)
#endif
#define int long long
// typedef __int128_t Int;
#define DBG 1
#define rep(i, a, b) for (int i = (a); i < (b); i++)
#define rrep(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define loop(n) rep(loop, (0), (n))
#define all(c) begin(c), end(c)
const int INF =
sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9) + 7;
const double PI = acos(-1);
const double EPS = 1e-9;
template <class T> bool chmax(T &a, const T &b) {
if (a < b) {
a = b;
return true;
}
return false;
}
template <class T> bool chmin(T &a, const T &b) {
if (a > b) {
a = b;
return true;
}
return false;
}
uint32_t x, y, z, w;
uint64_t seed;
void init() {
x = seed;
y = 1, z = 2, w = 3;
}
int32_t generate() {
uint32_t t = (x ^ (x << 11));
x = y;
y = z;
z = w;
w = (w ^ (w >> 19)) ^ (t ^ (t >> 8));
return w;
}
signed main() {
cin.tie(0);
ios::sync_with_stdio(false);
cout << fixed << setprecision(12);
cin >> seed;
init();
dump(generate());
dump(generate());
dump(generate());
dump(generate());
dump(generate());
dump(generate());
int l = 0, r = (1ll << 32);
int A = 10000001;
while (abs(r - l) > 1) {
int m = (l + r) / 2;
init();
int c = 0;
loop(A) {
int g = generate();
if (g < 0)
g += (1ll << 32);
if (g < m)
c++;
}
dump(l, r, m, c);
if (c <= 5000000)
l = m;
else
r = m;
}
cout << l << endl;
return 0;
}
oshibori