結果
| 問題 | No.702 中央値を求めよ LIMITED |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2019-10-16 16:41:00 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
CE
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 879 bytes |
| コンパイル時間 | 734 ms |
| コンパイル使用メモリ | 83,556 KB |
| 最終ジャッジ日時 | 2025-01-01 23:06:57 |
| 合計ジャッジ時間 | 1,156 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
コンパイルメッセージ
main.cpp:15:13: error: ‘uint32_t’ does not name a type
15 | using u32 = uint32_t;
| ^~~~~~~~
main.cpp:12:1: note: ‘uint32_t’ is defined in header ‘<cstdint>’; did you forget to ‘#include <cstdint>’?
11 | #include <cmath>
+++ |+#include <cstdint>
12 |
main.cpp:20:1: error: ‘u32’ does not name a type
20 | u32 x = 0, y = 1, z = 2, w = 3;
| ^~~
main.cpp: In function ‘void generate()’:
main.cpp:22:5: error: ‘u32’ was not declared in this scope
22 | u32 t = (x^(x<<11));
| ^~~
main.cpp:23:5: error: ‘x’ was not declared in this scope
23 | x = y;
| ^
main.cpp:23:9: error: ‘y’ was not declared in this scope; did you mean ‘yn’?
23 | x = y;
| ^
| yn
main.cpp:24:9: error: ‘z’ was not declared in this scope
24 | y = z;
| ^
main.cpp:25:9: error: ‘w’ was not declared in this scope
25 | z = w;
| ^
main.cpp:26:28: error: ‘t’ was not declared in this scope; did you mean ‘tm’?
26 | w = (w ^ (w >> 19)) ^ (t ^ (t >> 8));
| ^
| tm
main.cpp: In function ‘int main()’:
main.cpp:30:5: error: ‘u32’ was not declared in this scope
30 | u32 seed; cin >> seed;
| ^~~
main.cpp:30:22: error: ‘seed’ was not declared in this scope
30 | u32 seed; cin >> seed;
| ^~~~
main.cpp:31:15: error: template argument 2 is invalid
31 | vector<u32> v;
| ^
main.cpp:32:5: error: ‘x’ was not declared in this scope
32 | x = seed;
| ^
main.cpp:33:8: error: expected ‘;’ before ‘l’
33 | u32 l = 0, r = 0;
| ^~
| ;
main.cpp:36:12: error: ‘w’ was not declared in this scope
36 | if(w < 2143000000) l++;
| ^
main.cpp:36:28: error: ‘l’ was not declared in this scope
36
ソースコード
#include <limits>
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <bitset>
#include <cmath>
static const int MOD = 1000000007;
using ll = long long;
using u32 = uint32_t;
using namespace std;
template<class T> constexpr T INF = ::numeric_limits<T>::max()/32*15+208;
u32 x = 0, y = 1, z = 2, w = 3;
void generate() {
u32 t = (x^(x<<11));
x = y;
y = z;
z = w;
w = (w ^ (w >> 19)) ^ (t ^ (t >> 8));
}
int main() {
u32 seed; cin >> seed;
vector<u32> v;
x = seed;
u32 l = 0, r = 0;
for (int i = 0; i < 10000001; ++i) {
generate();
if(w < 2143000000) l++;
else if(w < 2152000000) v.emplace_back(w);
}
nth_element(v.begin(),v.begin()+(5000000-l), v.end());
cout << v[5000000-l] << "\n";
return 0;
}