結果
| 問題 | No.702 中央値を求めよ LIMITED |
| コンテスト | |
| ユーザー |
c-yan
|
| 提出日時 | 2021-02-17 01:06:00 |
| 言語 | C++17(clang) (clang++ 22.1.2 + boost 1.89.0) |
| 結果 |
CE
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 889 bytes |
| 記録 | |
| コンパイル時間 | 1,109 ms |
| コンパイル使用メモリ | 107,008 KB |
| 最終ジャッジ日時 | 2026-05-07 14:59:19 |
| 合計ジャッジ時間 | 2,958 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge3_0 |
(要ログイン)
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
コンパイルメッセージ
main.cpp:9:5: error: unknown type name 'uint32_t'
9 | uint32_t x, y, z, w;
| ^
main.cpp:11:14: error: unknown type name 'uint32_t'
11 | Xorshift(uint32_t seed){
| ^
main.cpp:17:5: error: unknown type name 'uint32_t'
17 | uint32_t operator()(){
| ^
main.cpp:18:9: error: unknown type name 'uint64_t'
18 | uint64_t t=(x^(x<<11));
| ^
main.cpp:25:3: error: unknown type name 'uint32_t'
25 | uint32_t seed; cin >> seed;
| ^
main.cpp:27:3: error: unknown type name 'uint32_t'
27 | uint32_t padding = 2500000;
| ^
main.cpp:28:3: error: unknown type name 'uint32_t'
28 | uint32_t bottom = (1<<31) - padding;
| ^
main.cpp:29:3: error: unknown type name 'uint32_t'
29 | uint32_t top = (1<<31) + padding;
| ^
main.cpp:30:10: error: use of undeclared identifier 'uint32_t'
30 | vector<uint32_t> ans;
| ^~~~~~~~
main.cpp:35:5: error: unknown type name 'uint32_t'
35 | uint32_t tmp = xorshift();
| ^
10 errors generated.
ソースコード
#include<iostream>
#include<vector>
#include <algorithm>
#define SIZE 10000001
using namespace std;
class Xorshift{
private:
uint32_t x, y, z, w;
public:
Xorshift(uint32_t seed){
x = seed;
y = 1;
z = 2;
w = 3;
}
uint32_t operator()(){
uint64_t t=(x^(x<<11));
x=y; y=z; z=w;
return w=(w^(w>>19))^(t^(t>>8));
}
};
int main(){
uint32_t seed; cin >> seed;
Xorshift xorshift(seed);
uint32_t padding = 2500000;
uint32_t bottom = (1<<31) - padding;
uint32_t top = (1<<31) + padding;
vector<uint32_t> ans;
ans.reserve(20000);
int cnt = 0;
for(int i = 0; i < SIZE; i++){
uint32_t tmp = xorshift();
if(tmp >= bottom && tmp <= top){
ans.push_back(tmp);
}else if(tmp < bottom){
cnt++;
}
}
sort(ans.begin(),ans.end());
cout << ans[SIZE/2 - cnt] <<endl;
return 0;
}
c-yan