logo AlgoBeat OnlineJudge
登录 注册

#10065. [Sleeping Cup #3] B. Not a median problem

内存限制:8 MiB 时间限制:2000 ms 输入文件:median.in 输出文件:median.out
题目类型:传统 评测方式:文本比较
上传者: 匿名

题目描述

注记:

由于评测原因,本场的 D 题没有搬入;由于质量原因和评测原因,本场的 A 题没有搬入。

测试点 1 - 5 为样例,测试点 6 - 10 满足 的限制,测试点 11 - 15 不满足这一限制。

由于评测机性能差异,本题的时间限制由 1 秒改为 2 秒。

本题的空间限制为 8 MB。

求给定的 个正整数(保证有奇数个)的中位数。

请在提交时请使用以下模板。你的程序将会读入一行两个正整数 (保证 为奇数),然后调用 get() 函数以获得 个正整数的值(保证不大于 )。你需要在获得 个正整数的值后输出它们的中位数。

#include <bits/stdc++.h>
using namespace std;
unsigned int n, x;
inline unsigned int get()
{
    x ^= x << 7;
    x ^= x >> 23;
    x ^= x << 12;
	return x;
}
int main()
{
    freopen("median.in", "r", stdin);
    freopen("median.out", "w", stdout);
    cin >> n >> x;
    unsigned int answer = 0;
    // Call the function 'get()' to get the integers.
    // You should call the function 'get()' exactly N times.
    // An integer will be given after each call.
    cout << answer << endl;
    return 0;
}

样例

样例输入 #1

1 3489531249

样例输出 #1

4213554576

样例输入 #2

3 3489531249

样例输出 #2

3736028483

样例输入 #3

5 3489531249

样例输出 #3

1591798959

样例输入 #4

7 3489531249

样例输出 #4

1591798959

样例输入 #5

9 3489531249

样例输出 #5

1591798959

数据范围与提示

样例解释

get() 函数返回的前 项分别是:

4213554576
3736028483
1464923601
1591798959
1159830386
399619033
2061643431
1546026288
3242329518

数据范围

  • 对于 的数据,
  • 对于 的数据,