結果
問題 | No.702 中央値を求めよ LIMITED |
ユーザー |
|
提出日時 | 2018-06-15 22:39:59 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
CE
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 745 bytes |
コンパイル時間 | 482 ms |
コンパイル使用メモリ | 58,552 KB |
最終ジャッジ日時 | 2025-01-02 00:24:42 |
合計ジャッジ時間 | 901 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
コンパイルメッセージ
main.cpp:6:1: error: ‘uint32_t’ does not name a type 6 | uint32_t x = 0, y = 1, z = 2, w = 3; | ^~~~~~~~ main.cpp:4:1: note: ‘uint32_t’ is defined in header ‘<cstdint>’; did you forget to ‘#include <cstdint>’? 3 | #include <vector> +++ |+#include <cstdint> 4 | using namespace std; main.cpp:7:1: error: ‘uint32_t’ does not name a type 7 | uint32_t generate() { | ^~~~~~~~ main.cpp:7:1: note: ‘uint32_t’ is defined in header ‘<cstdint>’; did you forget to ‘#include <cstdint>’? main.cpp: In function ‘int main()’: main.cpp:19:5: error: ‘x’ was not declared in this scope 19 | x = seed; | ^ main.cpp:20:12: error: ‘uint32_t’ was not declared in this scope 20 | vector<uint32_t> nums; | ^~~~~~~~ main.cpp:20:12: note: ‘uint32_t’ is defined in header ‘<cstdint>’; did you forget to ‘#include <cstdint>’? main.cpp:20:20: error: template argument 1 is invalid 20 | vector<uint32_t> nums; | ^ main.cpp:20:20: error: template argument 2 is invalid main.cpp:23:17: error: expected ‘;’ before ‘a’ 23 | uint32_t a = generate(); | ^~ | ; main.cpp:24:12: error: ‘a’ was not declared in this scope 24 | if(a <= 1e9 + 9e8){ | ^ main.cpp:27:18: error: request for member ‘push_back’ in ‘nums’, which is of non-class type ‘int’ 27 | nums.push_back(a); | ^~~~~~~~~ main.cpp:30:15: error: request for member ‘begin’ in ‘nums’, which is of non-class type ‘int’ 30 | sort(nums.begin(), nums.end(), greater<long>()); | ^~~~~ main.cpp:30:29: error: request for member ‘end’ in ‘nums’, which is of non-class type ‘int’ 30 | sort(nums.begin(), nums.end(), greater<long>()); | ^~~ main.cpp:32:14: error: request for member ‘pop_
ソースコード
#include <iostream> #include <algorithm> #include <vector> using namespace std; uint32_t x = 0, y = 1, z = 2, w = 3; uint32_t generate() { uint32_t t = (x^(x<<11)); x = y; y = z; z = w; w = (w ^ (w >> 19)) ^ (t ^ (t >> 8)); return w; } int main(){ int seed; cin >> seed; x = seed; vector<uint32_t> nums; int less_count = 0; for(int i = 0; i < 10000001; i++) { uint32_t a = generate(); if(a <= 1e9 + 9e8){ less_count++; }else if(a <= 2e9 + 3e8){ nums.push_back(a); } } sort(nums.begin(), nums.end(), greater<long>()); for(int i = less_count; i < int(5e6); i++){ nums.pop_back(); } cout << nums.back() << endl; }