結果
| 問題 | No.702 中央値を求めよ LIMITED |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2019-10-16 16:27:46 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
CE
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 870 bytes |
| コンパイル時間 | 522 ms |
| コンパイル使用メモリ | 84,380 KB |
| 最終ジャッジ日時 | 2025-01-02 00:14:12 |
| 合計ジャッジ時間 | 840 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、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:21:1: error: ‘u32’ does not name a type
21 | u32 generate() {
| ^~~
main.cpp: In function ‘int main()’:
main.cpp:31:5: error: ‘u32’ was not declared in this scope
31 | u32 seed; cin >> seed;
| ^~~
main.cpp:31:22: error: ‘seed’ was not declared in this scope
31 | u32 seed; cin >> seed;
| ^~~~
main.cpp:32:15: error: template argument 2 is invalid
32 | vector<u32> v;
| ^
main.cpp:33:5: error: ‘x’ was not declared in this scope
33 | x = seed;
| ^
main.cpp:34:8: error: expected ‘;’ before ‘l’
34 | u32 l = 0, r = 0;
| ^~
| ;
main.cpp:36:12: error: expected ‘;’ before ‘a’
36 | u32 a = generate();
| ^~
| ;
main.cpp:37:12: error: ‘a’ was not declared in this scope
37 | if(a < 2140000000) l++;
| ^
main.cpp:37:28: error: ‘l’ was not declared in this scope
37 | if(a < 2140000000) l++;
| ^
main.cpp:38:35: error: request for member ‘emplace_back’ in ‘v’, which is of non-class type ‘int’
38 | else if(a < 2155000000) v.emplace_back(a);
| ^~~~~~~~~~~~
main.cpp:40:12: error: request for member ‘begin’ in ‘v’, which is of non-class type ‘int’
40 | sort(v.begin(),v.end());
| ^~~~~
main.cpp:40:22: error: request for member ‘end’ in ‘v’, which is of non-class type ‘int’
40 | s
ソースコード
#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;
u32 generate() {
u32 t = (x^(x<<11));
x = y;
y = z;
z = w;
w = (w ^ (w >> 19)) ^ (t ^ (t >> 8));
return w;
}
int main() {
u32 seed; cin >> seed;
vector<u32> v;
x = seed;
u32 l = 0, r = 0;
for (int i = 0; i < 10000001; ++i) {
u32 a = generate();
if(a < 2140000000) l++;
else if(a < 2155000000) v.emplace_back(a);
}
sort(v.begin(),v.end());
cout << v[5000000-l] << "\n";
return 0;
}