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

Source: TJU School Competetion 2015

#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath> using namespace std; int main()
{
long long n,i,a,b,x,y,d,z;
cin>>z;
while(z--)
{
cin>>n;
a = ,b = ;
for(i = ;i<*n-;i++)
{
long long t;
scanf("%lld",&t);
a += n-i/-t;
b += (n-i/)*(n-i/)-t*t; }
d = sqrt(*b-a*a);
x = (a-d)/,y = (a+d)/;
cout<<x<<" "<<y<<endl;
}
return ;
}

toj4119HDFS的更多相关文章

随机推荐

  1. ural 1297 Palindrome(Manacher模板题)

    转载请注明出处: http://www.cnblogs.com/fraud/          ——by fraud 求最长回文子串. http://acm.timus.ru/problem.aspx ...

  2. Shell glob

    在Linux中,glob是用来匹配路径名的通配符,glob主要包含以下4种: Wildcard Matching * 匹配0个或者多个字符,比如d*,可以匹配d, d1, dd1 ?匹配单个字符,比如 ...

  3. Oracle创建主键自增表

    Oracle创建主键自增表   1.创建表    create table Test_Increase(            userid number(10) NOT NULL primary k ...

  4. java poi 合并单元格后边框问题

    在项目中用poi合并单元格,但发现边框会有不显示的问题. 在网上搜集了答案,来记录一下. 解决方法: 将每个没用到的单元格都设空值. 例如: HSSFCell cell = row.createCel ...

  5. [Head First Python]3. 文件与异常:处理错误

    datafile.txt Man: Is this the right room for an argument? Other Man: I've told you once. Man: No you ...

  6. regular expression 基本语法

    正则检测网址: http://regexpal.isbadguy.com/   (不包含界定符)   或  http://tool.chinaz.com/regex unicode转换工具 : htt ...

  7. python计算机视觉2:图像边缘检测

    我是一名初学者,如果你发现文中有错误,请留言告诉我,谢谢 如果需要检测到图像里面的边缘,首先我们需要知道边缘处具有什么特征. 对于一幅灰度图像来说,边缘两边的灰度值肯定不相同,这样我们才能分辨出哪里是 ...

  8. c++基础五个题(三)

    一.一个对象访问普通函数和虚函数的时候,哪一个更快? 访问普通函数更快,因为普通成员函数在编译阶段已经被确定,因此在访问时直接调用对应地址的函数,而虚函数在调用时,需要首先在虚函数表中查找虚函数所在的 ...

  9. mysql create routine 权限的一些说明

    1.如果用户有create routine 权限那么他就可以创建procedure | function . 2.如果用户创建了procedure | function 那么mysql 会自动赋予它对 ...

  10. Font Rending 的 Hint 机制对排版的影响

    Font Rending 的 Hint 机制对排版的影响[转] 在设计一种 Font 时,设计者使用的是一个抽象的单位,叫做 EM,来源于大写 M 的宽度(通常英文字体中大写 M 的宽度最大).EM ...