HDU 6040 stl
Hints of sd0061
Time Limit: 5000/2500 MS (Java/Others) Memory Limit: 131072/131072 K (Java/Others)
Total Submission(s): 2421 Accepted Submission(s): 736
There are n noobs in the team, the i-th of which has a rating ai. sd0061 prepares one hint for each contest. The hint for the j-th contest is a number bj, which means that the noob with the (bj+1)-th lowest rating is ordained by sd0061 for the j-th contest.
The coach asks constroy to make a list of contestants. constroy looks into these hints and finds out: bi+bj≤bk is satisfied if bi≠bj, bi<bk and bj<bk.
Now, you are in charge of making the list for constroy.
For each test case:
The first line contains five integers n,m,A,B,C. (1≤n≤107,1≤m≤100)
The second line contains m integers, the i-th of which is the number bi of the i-th hint. (0≤bi<n)
The n noobs' ratings are obtained by calling following function n times, the i-th result of which is ai.
unsigned x = A, y = B, z = C;
unsigned rng61() {
unsigned t;
x ^= x << 16;
x ^= x >> 5;
x ^= x << 1;
t = x;
x = y;
y = z;
z = t ^ x ^ y;
return z;
}
0 1 2
2 2 2 2 2
1 1
Case #2: 405510 405510
#pragma comment(linker, "/STACK:102400000,102400000")
#include <bits/stdc++.h>
#include <cstdlib>
#include <cstdio>
#include <iostream>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <cctype>
#include <map>
#include <set>
#include <queue>
#include <bitset>
#include <string>
#include <complex>
#define LL long long
#define mod 1000000007
using namespace std;
int n,m;
unsigned x,y,z,t,ans[];
unsigned rng61(){
x^=x<<;
x^=x>>;
x^=x<<;
t=x;
x=y;
y=z;
z=t^x^y;
return z;
}
unsigned aa[];
struct node
{
int xx;
int pos;
friend bool operator < (node aaa,node bbb)
{
return aaa.xx < bbb.xx;
}
}bb[];
int main()
{
int t=;
while(scanf("%d %d %u %u %u",&n,&m,&x,&y,&z)!=EOF){
for(int i=; i<=m; i++){
scanf("%d",&bb[i].xx);
bb[i].pos=i;
}
for(int i=; i<n; i++)
aa[i]=rng61();
sort(bb+,bb++m);
bb[m+].xx=n;
for(int i=m;i>=;i--){
nth_element(aa,aa+bb[i].xx,aa+bb[i+].xx);
ans[bb[i].pos]=aa[bb[i].xx];
}
printf("Case #%d:",++t);
for(int i=;i<=m;i++)
printf(" %u",ans[i]);
printf("\n");
}
return ;
}
HDU 6040 stl的更多相关文章
- HDU 6040 - Hints of sd0061 | 2017 Multi-University Training Contest 1
/* HDU 6040 - Hints of sd0061 [ 第k小数查询,剪枝 ] 题意: 给出随机数列 a[N] (N < 1e7) 询问 b[M] (M < 100) ,对于每个询 ...
- hdu 6040 Hints of sd0061(stl: nth_element(arr,arr+k,arr+n))
Hints of sd0061 Time Limit: 5000/2500 MS (Java/Others) Memory Limit: 131072/131072 K (Java/Others ...
- HDU 6040 Hints of sd0061(划分高低位查找)
[题目链接] http://acm.hdu.edu.cn/showproblem.php?pid=6040 [题目大意] 给出一个随机数生成器,有m个询问,问第bi小的元素是啥 询问中对于bi< ...
- HDU 6040 Hints of sd0061(nth_element)
[题目链接] http://acm.hdu.edu.cn/showproblem.php?pid=6040 [题目大意] 给出一个随机数生成器,有m个询问,问第bi小的元素是啥 询问中对于bi< ...
- hdu 4398 STL
题意描述半天描述不好,直接粘贴了 Now your team is participating a programming contest whose rules are slightly diffe ...
- hdu 4022 STL
题意:给你n个敌人的坐标,再给你m个炸弹和爆炸方向,每个炸弹可以炸横排或竖排的敌人,问你每个炸弹能炸死多少个人. /* HDU 4022 G++ 1296ms */ #include<stdio ...
- hdu 1412 (STL list)
简单例题 题目:http://acm.hdu.edu.cn/showproblem.php?pid=1412 list 相关博客:http://www.cnblogs.com/fangyukuan/a ...
- HDU 4022 stl multiset
orz kss太腻害了. 一.set和multiset基础 set和multiset会根据特定的排序准则,自动将元素进行排序.不同的是后者允许元素重复而前者不允许. 需要包含头文件: #include ...
- HDU 6040 Hints of sd0061 nth_element函数
Hints of sd0061 Problem Description sd0061, the legend of Beihang University ACM-ICPC Team, retired ...
随机推荐
- 阿里云ubuntu16.04安装beef
0x0 前言 环境:阿里云轻量服务器ubuntu16.04 需要安装2.4以上版本的ruby:https://www.cnblogs.com/Rain99-/p/10666247.html 参考资料 ...
- 使用Python 统计nginx日志前十ip访问量并以柱状图显示
脚本内容: import matplotlib.pyplot as plt # nginx_file = '10.6.11.91_access.log-2018-12-27' ip = {} #筛选n ...
- __construct 与 __destruct 区别
其实这个问法是有问题的,__construct 与 __destruct 没什么可比性,两个方法一个在对象被创建的时候触发,另一个在对象被销毁的时候触发 具体可以翻阅PHP官方手册中的 http:// ...
- xocde missing file 解决方法
创建一个警告里丢失的文件 托到警报的目录下 重启xcode 警告消失 在xcode中选中这个文件右键delete再次删掉文件,就OK了.
- 7.openldap使用ssl加密认证
作者:yaoyao 1.服务器端部署 1.自建CA中心 1.CA中心生成自身私钥 #cd /etc/pki/CA #(umask 077; openssl genrsa -out private/ca ...
- jenkins设置定时任务
每次都手动的构建项目显然不够方便,有时候需要定时地执行自动化测试脚本.例如,每天晚上定时执行 pjenkins.py 文件来运行自动化测试项目. 设置定时任务 前面已经创建的 “python test ...
- podSpec文件相关知识整理
上一篇文章整理了我用SVN创建私有库的过程,本文将整理一下有关podSpec文件的相关知识. podSpec中spec的全称是“Specification”,说明书的意思.顾名思义,这是用来描述你这个 ...
- sprint2(第三天)
展板 燃尽图
- Aspose.words Java基于模板生成word之循环图片
1.新建一个word文档 2.给插入图片的地方设置书签 3,设置书签 二,项目 1,2步的引入依赖以及加载授权文件同上一篇 3,获取图片路径插入到word中并生成新的word文档 新文档中,每行显示两 ...
- mybatis之模糊查询SQL
一,MySQL数据库 name like concat('%' , #{name} , '%') 二,Oracle数据库 name like '%' || #{name} || '%'