結果
問題 | No.702 中央値を求めよ LIMITED |
ユーザー |
![]() |
提出日時 | 2018-06-15 23:39:10 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
CE
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 681 bytes |
コンパイル時間 | 408 ms |
コンパイル使用メモリ | 58,848 KB |
最終ジャッジ日時 | 2025-01-02 01:05:15 |
合計ジャッジ時間 | 821 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
コンパイルメッセージ
main.cpp:8:1: error: ‘uint32_t’ does not name a type 8 | uint32_t x = 0, y = 1, z = 2, w = 3; | ^~~~~~~~ main.cpp:5:1: note: ‘uint32_t’ is defined in header ‘<cstdint>’; did you forget to ‘#include <cstdint>’? 4 | #include<set> +++ |+#include <cstdint> 5 | using namespace std; main.cpp:9:1: error: ‘uint32_t’ does not name a type 9 | uint32_t generate() { | ^~~~~~~~ main.cpp:9: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: ‘uint32_t’ was not declared in this scope 19 | uint32_t seed; cin >> seed; | ^~~~~~~~ main.cpp:19:5: note: ‘uint32_t’ is defined in header ‘<cstdint>’; did you forget to ‘#include <cstdint>’? main.cpp:19:27: error: ‘seed’ was not declared in this scope 19 | uint32_t seed; cin >> seed; | ^~~~ main.cpp:20:5: error: ‘x’ was not declared in this scope 20 | x = seed; | ^ main.cpp:26:15: error: ‘y’ was not declared in this scope 26 | x=seed; y=1; z=2; w=3; | ^ main.cpp:26:20: error: ‘z’ was not declared in this scope 26 | x=seed; y=1; z=2; w=3; | ^ main.cpp:26:25: error: ‘w’ was not declared in this scope 26 | x=seed; y=1; z=2; w=3; | ^ main.cpp:29:24: error: no matching function for call to ‘generate()’ 29 | auto a=generate(); | ~~~~~~~~^~ In file included from /usr/include/c++/13/algorithm:61, from main.cpp:3: /usr/include/c++/13/bits/stl_algo.h:4434:5: note: candidate: ‘template<class _FIter, class _Generator> void std::generate(_FIter, _FIter, _Generator)’ 4434 | generate(_ForwardIterator __first, _ForwardIterator __last, | ^~~~~~~~ /usr/include/c++/13/bits/stl_algo.h:4434:5: note: template argument ded
ソースコード
#include<iostream>#include<vector>#include<algorithm>#include<set>using namespace std;#define rep(i,n) for(int i=0;i<(n);i++)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(void) {uint32_t seed; cin >> seed;x = seed;int n=10000001;long long yes=0, no=4294967296;while(no-yes>1){auto m=(yes+no)/2;x=seed; y=1; z=2; w=3;int cnt=0;rep(_, n){auto a=generate();if(a<m) cnt++;}(cnt<=n/2 ? yes : no) = m;}cout<< yes<< endl;return 0;}