Tju 4119. HDFS
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的更多相关文章
- HDFS(数学题)
题目连接:http://acm.tju.edu.cn/toj/showp.php?pid=4119 4119. HDFS Time Limit: 5.0 Seconds Memory Limi ...
- hadoop 2.7.3本地环境运行官方wordcount-基于HDFS
接上篇<hadoop 2.7.3本地环境运行官方wordcount>.继续在本地模式下测试,本次使用hdfs. 2 本地模式使用fs计数wodcount 上面是直接使用的是linux的文件 ...
- Hadoop学习之旅二:HDFS
本文基于Hadoop1.X 概述 分布式文件系统主要用来解决如下几个问题: 读写大文件 加速运算 对于某些体积巨大的文件,比如其大小超过了计算机文件系统所能存放的最大限制或者是其大小甚至超过了计算机整 ...
- python基础操作以及hdfs操作
目录 前言 基础操作 hdfs操作 总结 一.前言 作为一个全栈工程师,必须要熟练掌握各种语言...HelloWorld.最近就被"逼着"走向了python开发之路, ...
- 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. ...
- HDFS的架构
主从结构 主节点,只有一个: namenode 从节点,有很多个: datanodes 在版本1中,主节点只有一个,在 版本2中主节点有两个. namenode 负责(管理): 接收用户操作请求 维护 ...
- hdfs以及hbase动态增加和删除节点
一个知乎上的问题:Hbase的Region server和hadoop的datanode是否可以部署在一台服务器上?如果是的话,二者是否是一对一的关系?部署在同一台服务器上,可以减少数据跨网络传输的流 ...
- 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 ...
- 01 HDFS 简介
01.HDFS简介 大纲: hadoop2 介绍 HDFS概述 HDFS读写流程 hadoop2介绍 框架的核心设计是HDFS(存储),mapReduce(分布式计算),YARN(资源管理),为海量的 ...
随机推荐
- pycharm运行没问题,但是在命令行执行就报错
因为python并不知道你那个叫demo的package在哪里.你需要手动把project的完整路径添加到PYTHONPATH这个环境变量中.pycharm执行项目中的文件时会自动帮你做这件事,所以你 ...
- 使用jemalloc优化nginx和mysql内存管理
预先安装autoconf 和 make yum -y install autoconf make jemalloc的安装jiemalloc 开源项目网站 http://www.canonware.co ...
- docker改变镜像源
sudo echo “DOCKER_OPTS=\”\$DOCKER_OPTS –registry-mirror=http://your-id.m.daocloud.io -d\”” >> ...
- Linux怎么读? Linux读音考古一日游
Linux怎么读? Linux读音考古一日游/*凡是准备踏入Linux大门的叉子们(N年不关注了,不知道这个称呼是否还有),都必须经历疑问 那就是linux到底怎么读? 也许有些人很容易 什么里纽克 ...
- HTML介绍&常用的标签
HTML介绍 1. web服务器本质 import socket s = socket.socket() s.bind(('127.0.0.1', 8080)) s.listen(5) while T ...
- 洛谷——P3119 [USACO15JAN]草鉴定Grass Cownoisseur
P3119 [USACO15JAN]草鉴定Grass Cownoisseur 题目描述 In an effort to better manage the grazing patterns of hi ...
- 通过k8s(Kubernetes)搭建jmeter的压测环境master-slave架构,实现弹性伸缩
在k8s上部署jmeter的mater和slave,根据压测需求动态增减master和slave节点数量,即可以完成压测任务,又可以是资源利用最大化 https://blog.kubernauts.i ...
- 纠结的链接——ln、ln -s、fs.symlink、require
纠结的链接--ln.ln -s.fs.symlink.require 提交 我的留言 加载中 已留言 inode 我们首先来看看 linux 系统里面的一个重要概念:inode. 我们知道,文件存储在 ...
- hdoj 1203 I NEED A OFFER! 【另类01背包】【概率背包】
题意:... 策略:动态规划. 由于是求至少能得到一个offer的概率,那我们能够反着求.求得不到一个offer的概率.最后用1减去就好了. 代码: #include<string.h> ...
- Android学习 多读官网,故意健康---手势
官网地址 ttp://developer.android.com/training/gestures/detector.html: 一.能够直接覆盖Activity的onTouch方法 public ...