2761: [JLOI2011]不重复数字(哈希表)
2761: [JLOI2011]不重复数字
Time Limit: 10 Sec Memory Limit: 128 MB
Submit: 1770 Solved: 675
[Submit][Status]
Description
Input
Output
Sample Input
11
1 2 18 3 3 19 2 3 6 5 4
6
1 2 3 4 5 6
Sample Output
1 2 3 4 5 6
HINT
对于30%的数据,1 <= N <= 100,给出的数不大于100,均为非负整数;
对于50%的数据,1 <= N <= 10000,给出的数不大于10000,均为非负整数;
对于100%的数据,1 <= N <= 50000,给出的数在32位有符号整数范围内。
提示:
由于数据量很大,使用C++的同学请使用scanf和printf来进行输入输出操作,以免浪费不必要的时间。
Source
const p=;
var
i,j,k,l,m,n:longint;
a,b:array[..p] of longint;
function fx(x:longint):longint;
begin
exit(((x mod p)+*p) mod p+);
end;
function check(x:longint):boolean;
var i,j:longint;
begin
i:=fx(x);
while b[i]<> do
begin
if a[i]=x then exit(true);
i:=i mod p+;
end;
b[i]:=;
a[i]:=x;
exit(false);
end;
begin
readln(m);
for i:= to m do
begin
readln(n);l:=;
fillchar(a,sizeof(a),);
fillchar(b,sizeof(b),);
for J:= to n do
begin
read(k);
if check(k)=false then
begin
if l= then write(' ') else l:=;
write(k);
end;
end;
writeln;
end;
end.
2761: [JLOI2011]不重复数字(哈希表)的更多相关文章
- bzoj 2761 [JLOI2011]不重复数字(哈希表)
2761: [JLOI2011]不重复数字 Time Limit: 10 Sec Memory Limit: 128 MBSubmit: 3210 Solved: 1186[Submit][Sta ...
- 2761: [JLOI2011]不重复数字(平衡树)
2761: [JLOI2011]不重复数字 Time Limit: 10 Sec Memory Limit: 128 MBSubmit: 2133 Solved: 825[Submit][Stat ...
- BZOJ 2761: [JLOI2011]不重复数字 水题
2761: [JLOI2011]不重复数字 Time Limit: 10 Sec Memory Limit: 162 MBSubmit: 2100 Solved: 809 题目连接 http:// ...
- BZOJ 2761: [JLOI2011]不重复数字 hash哈希
题目就不贴了 点我看题 题意:这题题意很简明,就是给一个序列,把序列里相同的删掉,然后输出,按原数列顺序. 思路:这题之前QZZ和ZN大神犇叫我去做,辣时还不会hash,就留着了.最近某夏令营学会了h ...
- 【BZOJ】2761: [JLOI2011]不重复数字(set+巨水题+超坑题)
http://www.lydsy.com/JudgeOnline/problem.php?id=2761 太水了,不说了. 但是这格式错误我已经没话说了....行末不能有空格 #include < ...
- 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]不重复数字
#include<cstdio> #include<iostream> #include<cstring> #include<algorithm> #d ...
- bzoj 2761: [JLOI2011]不重复数字【hash】
map会T,双hash会冲突--于是非酋写了个三hash #include<iostream> #include<cstdio> #include<cstring> ...
随机推荐
- C语言中strcpy,strcmp,strlen,strcat函数原型
//strcat(dest,src)把src所指字符串添加到dest结尾处(覆盖dest结尾处的'\0')并添加'\0' char *strcat(char * strDest, const char ...
- Servlet中进行context属性的同步
Servlet中进行context属性的同步: 必须所有使用context的servlet都进行synchronized才可以实现同步: servlet: package com.stono.serv ...
- SVG六基本元素
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...
- ASP.NET Zero--14.一个例子(7)商品分类管理-分类搜索及分页
分类搜索实现 1.添加搜索框 打开Index视图,添加一个搜索框,代码如下: ... <div class="portlet light"> <div class ...
- ubuntu下安装ssh服务器方法
由于xshell远程连接ubuntu是通过ssh协议的,所以,需要给ubuntu安装ssh服务器. 1)ubuntu安装ssh服务器 sudo apt-get install openssh-serv ...
- webpack入门+react环境配置
小结放在前:这篇文章主要是为下一篇的react提前铺好路,webpack是一个前端资源模块化管理和打包工具,说白了就是方便我们管理自己的常用的一些代码,比如你开发中用到sass以及jade同时用到es ...
- 睡不着,复习一下C++基础中的基础(深拷贝与浅拷贝)
#include <iostream> #include <string> #include <assert.h> using namespace std; //声 ...
- python书籍推荐
python书籍推荐列表: 技巧:关于如何在windows平台上行获取目录下的文件名称.(我的python书籍的位置E:\Python\Python_book) D:\>e: E:\>cd ...
- https post
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.N ...
- 【Java深入研究】2、JVM类加载机制
一.先看看编写出的代码的执行过程: 二.研究类加载机制的意义 从上图可以看出,类加载是Java程序运行的第一步,研究类的加载有助于了解JVM执行过程,并指导开发者采取更有效的措施配合程序执行. 研究类 ...