結果
問題 | No.702 中央値を求めよ LIMITED |
ユーザー |
![]() |
提出日時 | 2018-06-16 16:41:53 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 745 ms / 5,000 ms |
コード長 | 708 bytes |
コンパイル時間 | 1,614 ms |
コンパイル使用メモリ | 167,352 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-22 22:28:48 |
合計ジャッジ時間 | 23,288 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 25 |
ソースコード
#include <bits/stdc++.h>using namespace std;int main(){struct generate{uint32_t x = 0, y = 1, z = 2, w = 3, seed;void reset(){x = seed;y = 1;z = 2;w = 3;}uint32_t operator()(){uint32_t t = (x ^ (x << 11));x = y;y = z;z = w;w = (w ^ (w >> 19)) ^ (t ^ (t >> 8));return w;}} g;int64_t seed, n = 10000000;cin >> seed;g.seed = seed;int64_t l = 0, r = (1ll << 40);while (1 < r - l){int64_t mid = (l + r) / 2;int count = 0;g.reset();for (int i = 0; i <= n; i++){if (g() <= mid){count++;}}if (2 * count <= n){l = mid;}else{r = mid;}}cout << r << endl;return 0;}