bzoj 2761: [JLOI2011]不重复数字
#include<cstdio>
#include<iostream>
#include<cstring>
#include<algorithm>
#define M 50008
using namespace std;
struct data
{
int b1,b2;
}a[M],c[M];
int T,n,b[M],cnt;
bool cmp(data a1,data a2)
{
if(a1.b1==a2.b1)
return a1.b2<a2.b2;
return a1.b1<a2.b1;
}
bool cmp1(data a1,data a2)
{
return a1.b2<a2.b2;
}
int main()
{
scanf("%d",&T);
for(;T--;)
{
memset(a,,sizeof(a));
memset(c,,sizeof(c));
scanf("%d",&n);
for(int i=;i<=n;i++)
{
scanf("%d",&a[i].b1);
a[i].b2=i;
}
sort(a+,a+n+,cmp);
cnt=;
c[]=a[];
for(int i=;i<=n;i++)
if(a[i].b1!=a[i-].b1)
{
cnt++;
c[cnt]=a[i];
}
sort(c+,c+cnt+,cmp1);
for(int i=;i<cnt;i++)
printf("%d ",c[i].b1);
printf("%d",c[cnt].b1);
printf("\n");
}
return ;
}
排序去重。
bzoj 2761: [JLOI2011]不重复数字的更多相关文章
- BZOJ 2761: [JLOI2011]不重复数字 水题
2761: [JLOI2011]不重复数字 Time Limit: 10 Sec Memory Limit: 162 MBSubmit: 2100 Solved: 809 题目连接 http:// ...
- bzoj 2761 [JLOI2011]不重复数字(哈希表)
2761: [JLOI2011]不重复数字 Time Limit: 10 Sec Memory Limit: 128 MBSubmit: 3210 Solved: 1186[Submit][Sta ...
- BZOJ 2761: [JLOI2011]不重复数字 set
Description 给出N个数,要求把其中重复的去掉,只保留第一次出现的数. 例如,给出的数为1 2 18 3 3 19 2 3 6 5 4,其中2和3有重复,去除后的结果为1 2 18 3 19 ...
- bzoj 2761: [JLOI2011]不重复数字 (map||Treap)
链接:https://www.lydsy.com/JudgeOnline/problem.php?id=2761 思路: map标记 实现代码: #include<bits/stdc++.h&g ...
- BZOJ 2761: [JLOI2011]不重复数字 hash哈希
题目就不贴了 点我看题 题意:这题题意很简明,就是给一个序列,把序列里相同的删掉,然后输出,按原数列顺序. 思路:这题之前QZZ和ZN大神犇叫我去做,辣时还不会hash,就留着了.最近某夏令营学会了h ...
- bzoj 2761: [JLOI2011]不重复数字【hash】
map会T,双hash会冲突--于是非酋写了个三hash #include<iostream> #include<cstdio> #include<cstring> ...
- 2761: [JLOI2011]不重复数字(平衡树)
2761: [JLOI2011]不重复数字 Time Limit: 10 Sec Memory Limit: 128 MBSubmit: 2133 Solved: 825[Submit][Stat ...
- 2761: [JLOI2011]不重复数字(哈希表)
2761: [JLOI2011]不重复数字 Time Limit: 10 Sec Memory Limit: 128 MBSubmit: 1770 Solved: 675[Submit][Stat ...
- 【BZOJ】2761: [JLOI2011]不重复数字(set+巨水题+超坑题)
http://www.lydsy.com/JudgeOnline/problem.php?id=2761 太水了,不说了. 但是这格式错误我已经没话说了....行末不能有空格 #include < ...
随机推荐
- Unable to create SVNRepository object
I think you are missing at least the library setup stuff: /* * Initializes the library to w ...
- WORD基础快捷键
选择 Alt+Shift+上下 移动整行 Ctrl+上 移动到行首 Ctrl+Shift+上下 选择到行首尾 shift+del 删除整段 ...
- 2016年上半年金融类App成绩单,手机银行优势尽显! (转自Analysys易观(ID:enfodesk))
2016已悄然时过大半,金融各领域经过了开年大战,二季度末尾的6月更是几家欢喜几家愁,其中频繁出现的黑马更是足够让人惊喜.我们基于易观千帆6月移动应用大数据,筛选了百款金融类App为您揭晓TOP100 ...
- Python之检查URL
# -*- coding: utf-8 -*- import os,sys import time import sys import pycurl #URL="http://www.bai ...
- python: HTML中的选择器
id选择器 <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF ...
- easyui DataGrid 工具类之 列属性class
public class ColumnVO { /** * 列标题文本 */ private String title; /** * 列字段名称 */ pr ...
- 【转】malloc与free的底层实现
本文转自:http://blog.163.com/xychenbaihu@yeah/blog/static/132229655201210975312473/ 如何查看进程发生缺页中断的次数? 用ps ...
- js轮播
<!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8&qu ...
- html5 svg动画
http://www.zhangxinxu.com/sp/svg/ 以上是svg的一个线上编辑器,也可以adobe Illustrator制作生成. 我们通过以上编辑器可以获得以下代码. 例: < ...
- spring cache
spring-ehcache.xml文件内容如下: <?xml version="1.0" encoding="UTF-8"?> <beans ...