結果
問題 |
No.702 中央値を求めよ LIMITED
|
ユーザー |
|
提出日時 | 2023-02-23 11:50:56 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
CE
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 827 bytes |
コンパイル時間 | 697 ms |
コンパイル使用メモリ | 77,776 KB |
最終ジャッジ日時 | 2025-01-01 23:03:47 |
合計ジャッジ時間 | 1,389 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
コンパイルメッセージ
main.cpp:16:1: error: ‘uint32_t’ does not name a type 16 | uint32_t x = 0, y = 1, z = 2, w = 3; | ^~~~~~~~ main.cpp:14:1: note: ‘uint32_t’ is defined in header ‘<cstdint>’; did you forget to ‘#include <cstdint>’? 13 | #include <bitset> +++ |+#include <cstdint> 14 | using namespace std; main.cpp:17:1: error: ‘uint32_t’ does not name a type 17 | uint32_t generate() { | ^~~~~~~~ main.cpp:17:1: note: ‘uint32_t’ is defined in header ‘<cstdint>’; did you forget to ‘#include <cstdint>’? main.cpp: In function ‘int main()’: main.cpp:33:5: error: ‘x’ was not declared in this scope 33 | x = seed, y = 1, z = 2, w = 3; | ^ main.cpp:33:15: error: ‘y’ was not declared in this scope 33 | x = seed, y = 1, z = 2, w = 3; | ^ main.cpp:33:22: error: ‘z’ was not declared in this scope 33 | x = seed, y = 1, z = 2, w = 3; | ^ main.cpp:33:29: error: ‘w’ was not declared in this scope 33 | x = seed, y = 1, z = 2, w = 3; | ^ main.cpp:35:29: error: no matching function for call to ‘generate()’ 35 | long long a = generate(); | ~~~~~~~~^~ In file included from /usr/include/c++/13/algorithm:61, from main.cpp:8: /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 deduction/substitution failed: main.cpp:35:29: note: candidate expects 3 arguments, 0 provided 35 | long long a = generate(); | ~~~~~~~~^~
ソースコード
#include <iostream> #include <stdio.h> #include <string.h> #include <vector> #include <string> #include <set> #include <map> #include <algorithm> #include <numeric> #include <queue> #include <cassert> #include <cmath> #include <bitset> 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() { int64_t seed; cin >> seed; long long ok = 10000000000; long long ng = -1; while (ng + 1 < ok) { long long m = (ok + ng) / 2; int cnt = 0; x = seed, y = 1, z = 2, w = 3; for (int i = 0; i < 10000001; i++) { long long a = generate(); if (a <= m) cnt++; } if (cnt <= 10000001/2) ng = m; else ok = m; } cout << ok << endl; return 0; }