4119.   HDFS


Time Limit: 5.0 Seconds   Memory Limit: 5000K
Total Runs: 225   Accepted Runs: 77

In HDFS( Hadoop Distributed File System), each data may have a lot of copies in case of data lose.
This problem, every data has its own id, from 1 to n. To make things simple, each data has only two copies.
This time, the HDFS is cracked by some stupid reason. Fortunately, tmeteorj knows that there are actually 2 data lost by his keen intuition.
Now, it is your time to show your value of life. You should tell tmeteorj the id of lost data.

INPUT

First line, there will a number T(1≤T≤10), means the test case of this problem.
After this, each line is first a number n(1≤n≤5000000), means data id is from 1 to n. Then there will be 2(n-1) numbers means the id of data in health state.

OUTPUT

For each case, print the lost id of data. The smaller id is in the front of the bigger one.

Sample Input


3
4 1 1 2 3 4 4
4 1 2 3 1 2 4
4 2 3 4 2 3 1

Sample Output


2 3
3 4
1 4

 

题目大意:求数据中没有出现两次的那两个数。

这题主要是卡内存...坑

对于这种题目,set map都会爆内存,所以考虑用biset记录一下出现没有。

/* ***********************************************
Author :guanjun
Created Time :2016/6/25 12:20:55
File Name :tju4119.cpp
************************************************ */
#include <iostream>
#include <cstring>
#include <cstdlib>
#include <stdio.h>
#include <algorithm>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <string>
#include <math.h>
#include <stdlib.h>
#include <iomanip>
#include <list>
#include <deque>
#include <stack>
#include <bitset>
#define ull unsigned long long
#define ll long long
#define mod 90001
#define INF 0x3f3f3f3f
#define maxn 10010
#define cle(a) memset(a,0,sizeof(a))
const ull inf = 1LL << ;
const double eps=1e-;
using namespace std; bitset<>b;
vector<int>v;
bitset<>c;
int main()
{
// freopen("in.txt","r",stdin);
int t,n,x;
cin>>t;
while(t--){
cin>>n;
b.reset();
c.reset();
int w=;
for(int i=;i<=n*-;i++){
scanf("%d",&x);
w^=x;
if(b[x]==){
b[x]=;
c[x]=;
}
else{
b[x]=;
c[x]=;
}
}
v.clear();
if(w==){
for(int i=;i<=n;i++){
if(c[i]==){
v.push_back(i);
v.push_back(i);
break;
}
}
}
else{
for(int i=;i<=n;i++){
if(b[i]==){
v.push_back(i);
}
}
}
cout<<v[]<<" "<<v[]<<endl;
}
return ;
}

Tju 4119. HDFS的更多相关文章

  1. HDFS(数学题)

    题目连接:http://acm.tju.edu.cn/toj/showp.php?pid=4119 4119.   HDFS Time Limit: 5.0 Seconds   Memory Limi ...

  2. hadoop 2.7.3本地环境运行官方wordcount-基于HDFS

    接上篇<hadoop 2.7.3本地环境运行官方wordcount>.继续在本地模式下测试,本次使用hdfs. 2 本地模式使用fs计数wodcount 上面是直接使用的是linux的文件 ...

  3. Hadoop学习之旅二:HDFS

    本文基于Hadoop1.X 概述 分布式文件系统主要用来解决如下几个问题: 读写大文件 加速运算 对于某些体积巨大的文件,比如其大小超过了计算机文件系统所能存放的最大限制或者是其大小甚至超过了计算机整 ...

  4. python基础操作以及hdfs操作

    目录 前言 基础操作 hdfs操作 总结 一.前言        作为一个全栈工程师,必须要熟练掌握各种语言...HelloWorld.最近就被"逼着"走向了python开发之路, ...

  5. C#、JAVA操作Hadoop(HDFS、Map/Reduce)真实过程概述。组件、源码下载。无法解决:Response status code does not indicate success: 500。

    一.Hadoop环境配置概述 三台虚拟机,操作系统为:Ubuntu 16.04. Hadoop版本:2.7.2 NameNode:192.168.72.132 DataNode:192.168.72. ...

  6. HDFS的架构

    主从结构 主节点,只有一个: namenode 从节点,有很多个: datanodes 在版本1中,主节点只有一个,在 版本2中主节点有两个. namenode 负责(管理): 接收用户操作请求 维护 ...

  7. hdfs以及hbase动态增加和删除节点

    一个知乎上的问题:Hbase的Region server和hadoop的datanode是否可以部署在一台服务器上?如果是的话,二者是否是一对一的关系?部署在同一台服务器上,可以减少数据跨网络传输的流 ...

  8. hadoop程序问题:java.lang.IllegalArgumentException: Wrong FS: hdfs:/ expected file:///

    Java代码如下: FileSystem fs = FileSystem.get(conf); in = fs.open(new Path("hdfs://192.168.130.54:19 ...

  9. 01 HDFS 简介

    01.HDFS简介 大纲: hadoop2 介绍 HDFS概述 HDFS读写流程 hadoop2介绍 框架的核心设计是HDFS(存储),mapReduce(分布式计算),YARN(资源管理),为海量的 ...

随机推荐

  1. python基础——5(元组、字典、集合)

    上节复习: # 数字类型 # int:py3|py2  long:py2 # float: 3.14 # complex(5, 4) => 5 + 4j num = 12345678901234 ...

  2. UI进阶 即时通讯之XMPP环境搭建

    内容中包含 base64string 图片造成字符过多,拒绝显示

  3. C++中的左移、右移运算

    移位运算包含“逻辑移位”(logical shift)和“算术移位”(arithmetic shift). 逻辑移位:移出去的位丢弃,空缺位(vacant bit)用 0 填充. 算术移位:移出去的位 ...

  4. 深入理解ajax系列第五篇

    前面的话 一般地,使用readystatechange事件探测HTTP请求的完成.XHR2规范草案定义了进度事件Progress Events规范,XMLHttpRequest对象在请求的不同阶段触发 ...

  5. msp430项目编程27

    msp430中项目---多机通信系统 1.I2C工作原理 2.I2C通信协议 3.代码(显示部分) 4.代码(功能实现) 5.项目总结 msp430项目编程 msp430入门学习

  6. CSS属性操作二

    9.float属性 基本浮动规则 先来了解一下block元素和inline元素在文档流中的排列方式. block元素通常被现实为独立的一块,独占一行,多个block元素会各自新起一行,默认block元 ...

  7. 三、fs文件操作模块

    fs模块用于文件的读写等操作. 该模块有如下这些方法: 1.fs.stat() : 检测是文件还是目录 const fs = require('fs'); fs.stat('test.html',fu ...

  8. PAT (Advanced Level) 1031. Hello World for U (20)

    简单题. #include<iostream> #include<cstring> #include<cmath> #include<algorithm> ...

  9. redis连接数据库进行操作

    该项目需要的类目录 1.首先我们需要创建我们的实体类 2.放置我们的dao层,在里面写入方法 3.配置类Appconfig需要加入我们的JdbcTemplate方法,因为我们用的是spring,所以需 ...

  10. &quot;undefined reference to strptime&quot;之自己定义strptime函数

    简单介绍   strptime()函数可以依照特定时间格式将字符串转换为时间类型.简单点说可以将字符串时间转化为时间戳. 这个函数包括在time.h头文件里,在Unix或者类Unix系统中,我们会常常 ...