#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]不重复数字的更多相关文章

  1. BZOJ 2761: [JLOI2011]不重复数字 水题

    2761: [JLOI2011]不重复数字 Time Limit: 10 Sec  Memory Limit: 162 MBSubmit: 2100  Solved: 809 题目连接 http:// ...

  2. bzoj 2761 [JLOI2011]不重复数字(哈希表)

    2761: [JLOI2011]不重复数字 Time Limit: 10 Sec  Memory Limit: 128 MBSubmit: 3210  Solved: 1186[Submit][Sta ...

  3. BZOJ 2761: [JLOI2011]不重复数字 set

    Description 给出N个数,要求把其中重复的去掉,只保留第一次出现的数. 例如,给出的数为1 2 18 3 3 19 2 3 6 5 4,其中2和3有重复,去除后的结果为1 2 18 3 19 ...

  4. bzoj 2761: [JLOI2011]不重复数字 (map||Treap)

    链接:https://www.lydsy.com/JudgeOnline/problem.php?id=2761 思路: map标记 实现代码: #include<bits/stdc++.h&g ...

  5. BZOJ 2761: [JLOI2011]不重复数字 hash哈希

    题目就不贴了 点我看题 题意:这题题意很简明,就是给一个序列,把序列里相同的删掉,然后输出,按原数列顺序. 思路:这题之前QZZ和ZN大神犇叫我去做,辣时还不会hash,就留着了.最近某夏令营学会了h ...

  6. bzoj 2761: [JLOI2011]不重复数字【hash】

    map会T,双hash会冲突--于是非酋写了个三hash #include<iostream> #include<cstdio> #include<cstring> ...

  7. 2761: [JLOI2011]不重复数字(平衡树)

    2761: [JLOI2011]不重复数字 Time Limit: 10 Sec  Memory Limit: 128 MBSubmit: 2133  Solved: 825[Submit][Stat ...

  8. 2761: [JLOI2011]不重复数字(哈希表)

    2761: [JLOI2011]不重复数字 Time Limit: 10 Sec  Memory Limit: 128 MBSubmit: 1770  Solved: 675[Submit][Stat ...

  9. 【BZOJ】2761: [JLOI2011]不重复数字(set+巨水题+超坑题)

    http://www.lydsy.com/JudgeOnline/problem.php?id=2761 太水了,不说了. 但是这格式错误我已经没话说了....行末不能有空格 #include < ...

随机推荐

  1. HTML5 webSQL 中查询结果集 result.rows.item 的用法

    加入查询回调函数如下: function(tx,result){ var len = result.rows.length; var recordset = result.rows.item; ){ ...

  2. quay.io/coreos/etcd 基于Docker镜像的集群搭建

    etcd是一个高可用的键值存储系统,主要用于共享配置和服务发现.etcd是由CoreOS开发并维护的,灵感来自于 ZooKeeper 和 Doozer,它使用Go语言编写,并通过Raft一致性算法处理 ...

  3. Digital Roots 1013

    Digital Roots 时间限制(普通/Java):1000MS/3000MS          运行内存限制:65536KByte总提交:456            测试通过:162 描述 T ...

  4. 解读HTML 5新语法 提高语义价值

    HTML 5的新标记 设计者们需要完成的任务是要给HTML 5开发一个更丰富的和更有含义的语义,当然可以想象这种新方案将会是很灵活和很高效的,同时与所有的现代互联网标准相适应.下面就是一些将要在HTM ...

  5. 2016年12月23日 星期五 --出埃及记 Exodus 21:18

    2016年12月23日 星期五 --出埃及记 Exodus 21:18 "If men quarrel and one hits the other with a stone or with ...

  6. selenium操作浏览器cookie方法

    /**     * 操作浏览器的cookie     */        @Test    public void testCookie()throws Exception{        drive ...

  7. Intent 匹配规则

    1.在AndroidManifest.xml中可以为 每个 Activity,Service 设置多个Intent-Filter; 在系统启动和程序安装之后,android会收集AndroidMani ...

  8. 皇后(queen)

    皇后(queen)[题目描述] 众所不知,rly现在不会玩国际象棋.但是,作为一个OIer,rly当然做过八皇后问题.这里再啰嗦几句,皇后可以攻击到同行同列同对角线,在n*n的方格中摆n个皇后使其互不 ...

  9. radius服务器搭建

    yum install -y unzip gcc-c++ cd /opt unzip release-stable.zip mv ToughRADIUS-release-stable toughrad ...

  10. java第三章动手动脑

    public class InitializeBlockDemo { /** * @param args */ public static void main(String[] args) { Ini ...