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

    传统题 文件IO:median 1000ms 8MiB

[Sleeping Cup #3] Not a median problem

该比赛已结束,您无法在比赛模式下递交该题目。您可以点击“在题库中打开”以普通模式查看和递交本题。

负责人

注意

请严格按照提交方式进行操作。

本题的空间限制为 8 MB。

题目描述

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

提交方式

请使用以下模板。你的程序将会读入一行两个正整数 n,xn,x(保证 nn 为奇数),然后调用 nnget() 函数以获得 nn 个正整数的值(保证不大于 23212^{32}-1)。你需要在获得 nn 个正整数的值后输出它们的中位数。

#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 3489531249
4213554576
3 3489531249
3736028483
5 3489531249
1591798959
7 3489531249
1591798959
9 3489531249
1591798959

样例解释

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

4213554576
3736028483
1464923601
1591798959
1159830386
399619033
2061643431
1546026288
3242329518

数据范围

  • 对于 50%50\% 的数据,1n105+11 \le n \le 10^5+1
  • 对于 100%100\% 的数据,1n108+11 \le n \le 10^8+11x23211 \le x \le 2^{32}-1

官方题解

link

Sleeping Cup #3 (Random Round / Goodbye 2024)

未参加
状态
已结束
规则
IOI
题目
4
开始于
2024-12-28 0:00
结束于
2025-3-3 0:00
持续时间
1 小时
主持人
参赛人数
23