結果
| 問題 |
No.702 中央値を求めよ LIMITED
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2018-06-28 20:18:32 |
| 言語 | C++17(clang) (17.0.6 + boost 1.87.0) |
| 結果 |
CE
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 734 bytes |
| コンパイル時間 | 632 ms |
| コンパイル使用メモリ | 110,592 KB |
| 最終ジャッジ日時 | 2025-01-01 22:44:26 |
| 合計ジャッジ時間 | 1,033 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
コンパイルメッセージ
main.cpp:5:1: error: unknown type name 'uint32_t'
5 | uint32_t x = 0, y = 1, z = 2, w = 3;
| ^
main.cpp:5:18: error: expected ';' after top level declarator
5 | uint32_t x = 0, y = 1, z = 2, w = 3;
| ^
| ;
main.cpp:6:1: error: unknown type name 'uint32_t'
6 | uint32_t a[6000001];
| ^
main.cpp:8:1: error: unknown type name 'uint32_t'
8 | uint32_t generate() {
| ^
main.cpp:9:5: error: unknown type name 'uint32_t'
9 | uint32_t t = (x^(x<<11));
| ^
main.cpp:10:9: error: use of undeclared identifier 'y'
10 | x = y;
| ^
main.cpp:11:5: error: use of undeclared identifier 'y'
11 | y = z;
| ^
main.cpp:11:9: error: use of undeclared identifier 'z'
11 | y = z;
| ^
main.cpp:12:5: error: use of undeclared identifier 'z'
12 | z = w;
| ^
main.cpp:12:9: error: use of undeclared identifier 'w'
12 | z = w;
| ^
main.cpp:13:5: error: use of undeclared identifier 'w'
13 | w = (w ^ (w >> 19)) ^ (t ^ (t >> 8));
| ^
main.cpp:13:10: error: use of undeclared identifier 'w'
13 | w = (w ^ (w >> 19)) ^ (t ^ (t >> 8));
| ^
main.cpp:13:15: error: use of undeclared identifier 'w'
13 | w = (w ^ (w >> 19)) ^ (t ^ (t >> 8));
| ^
main.cpp:14:12: error: use of undeclared identifier 'w'
14 | return w;
| ^
main.cpp:23:9: error: unknown type name 'uint32_t'
23 | uint32_t next_num = generate();
| ^
main.cpp:23:29: error: no matching function for call to 'generate'
23 | uint32_t next_num = generate();
| ^~~~~~~~
/usr/lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/stl_algo.h:4434:5: note: candidate function template not viable: requires 3 arguments, but 0 were provided
4434 | generate(_ForwardIterator __first, _ForwardIterator __last,
ソースコード
#include <iostream>
#include <algorithm>
using namespace std;
uint32_t x = 0, y = 1, z = 2, w = 3;
uint32_t a[6000001];
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) {
int64_t seed; cin >> seed;
x = seed;
int l1bcnt = 0;
int index = 0;
for (int i = 0; i < 10000001; i++) {
uint32_t next_num = generate();
if (next_num < 1000000000) {
l1bcnt++;
} else if (next_num < 3000000000L) {
a[index] = next_num;
index++;
}
}
int median_index = 10000001 / 2 - l1bcnt;
sort(a, a + index);
cout << a[median_index] << endl;
}