結果
問題 |
No.702 中央値を求めよ LIMITED
|
ユーザー |
|
提出日時 | 2018-11-17 21:38:30 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
CE
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 797 bytes |
コンパイル時間 | 580 ms |
コンパイル使用メモリ | 52,744 KB |
最終ジャッジ日時 | 2025-01-02 00:49:55 |
合計ジャッジ時間 | 922 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
コンパイルメッセージ
main.cpp:5:1: error: ‘uint32_t’ does not name a type 5 | uint32_t x = 0, y = 1, z = 2, w = 3; | ^~~~~~~~ main.cpp:3:1: note: ‘uint32_t’ is defined in header ‘<cstdint>’; did you forget to ‘#include <cstdint>’? 2 | #include<climits> +++ |+#include <cstdint> 3 | using namespace std; main.cpp: In function ‘void init()’: main.cpp:9:5: error: ‘x’ was not declared in this scope 9 | x = 0, y = 1, z = 2, w = 3; | ^ main.cpp:9:12: error: ‘y’ was not declared in this scope 9 | x = 0, y = 1, z = 2, w = 3; | ^ main.cpp:9:19: error: ‘z’ was not declared in this scope 9 | x = 0, y = 1, z = 2, w = 3; | ^ main.cpp:9:26: error: ‘w’ was not declared in this scope 9 | x = 0, y = 1, z = 2, w = 3; | ^ main.cpp: At global scope: main.cpp:13:1: error: ‘uint32_t’ does not name a type 13 | uint32_t generate() { | ^~~~~~~~ main.cpp:13:1: note: ‘uint32_t’ is defined in header ‘<cstdint>’; did you forget to ‘#include <cstdint>’? main.cpp:22:12: error: ‘uint32_t’ was not declared in this scope 22 | bool check(uint32_t mid){ | ^~~~~~~~ main.cpp:22:12: note: ‘uint32_t’ is defined in header ‘<cstdint>’; did you forget to ‘#include <cstdint>’? main.cpp: In function ‘int main()’: main.cpp:40:5: error: ‘uint32_t’ was not declared in this scope 40 | uint32_t l = 0, r = UINT_MAX; | ^~~~~~~~ main.cpp:40:5: note: ‘uint32_t’ is defined in header ‘<cstdint>’; did you forget to ‘#include <cstdint>’? main.cpp:42:11: error: ‘r’ was not declared in this scope 42 | while(r != l){ | ^ main.cpp:42:16: error: ‘l’ was not declared in this scope; did you mean ‘ll’? 42 | while(r != l){ | ^ | ll main.cpp:43:17: error: expected ‘;’ before ‘mid’ 43 | uint3
ソースコード
#include<iostream> #include<climits> using namespace std; uint32_t x = 0, y = 1, z = 2, w = 3; int64_t seed; void init(){ x = 0, y = 1, z = 2, w = 3; x = seed; } uint32_t generate() { uint32_t t = (x^(x<<11)); x = y; y = z; z = w; w = (w ^ (w >> 19)) ^ (t ^ (t >> 8)); return w; } bool check(uint32_t mid){ int cnt = 0; init(); uint32_t tmp; for(int i = 0; i < 10000001; i++){ tmp = generate(); if(tmp <= mid) cnt++; } return cnt >= 5000001; } typedef long long ll; int main(){ cin >> seed; uint32_t l = 0, r = UINT_MAX; while(r != l){ uint32_t mid = l + (r-l)/2; if(check(mid)) r = mid; else l = mid+1; } cout << l << endl; return 0; }