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. React-Native做一个文本输入框组件

    我又回来啦! 由于最近一直在做公司的项目,而且比较急.如今项目已经迭代到第三期,可以缓一缓了... 说实话,最近一直再用android做开发,而且时间也不宽裕,react-native有点生疏了. 好 ...

  2. Unity脚本——Csharp

    打印输出: Debug.Log(""); 游戏流程函数: Awake():在对象被创建的时候调用. Start():在Awake()方法之后执行.在脚本禁用后不会执行. updat ...

  3. PHP函数参数的引用传递和值传递

    函数的参数传递有两种方式 1,值传递 常见的 test($param)  方式就是值传递,在函数内部修改$param,不会影响外部变量$param的值 2,引用传递 参数是引用传递的方式,此时函数内部 ...

  4. js抽象类和抽象方法

    js中模拟抽象类:在父类中调用一个未定义的方法,这个方法在子类中必须被实现. 1, 模拟类的工厂模式 //基类 var Class = { //基类的静态方法 creat:function(){ // ...

  5. HTML基本标签大全

    HTML标签 <h#></h#>标题标签<hr/>水平线,单标记<p></p>段落标签&nbsp 空格<i></i ...

  6. Jmeter -- 初体验

    一.Jmeter参数 在命令行输入Jmeter --help得到以下信息: To run Apache JMeter in GUI mode:Double-click on the ApacheJMe ...

  7. [TYVJ] P1049 最长不下降子序列

    最长不下降子序列 描述 Description 求最长不下降子序列的长度   输入格式 InputFormat 第一行为n,表示n个数第二行n个数   输出格式 OutputFormat 最长不下降子 ...

  8. Oracle Trunc

    http://www.cnblogs.com/xiaoyudz/archive/2011/03/18/1988467.html

  9. SCSI磁盘标准的架构与文档

    来自scsi标准的官方网站http://t10.org/,具体的文档可以去浏览官方网站. (*) This chart reflects the currently approved SCSI pro ...

  10. Sed 与 Linux 等价命令代码鉴赏(转)

    参考了     http://www.chinaunix.net/jh/24/307045.html                       sed     http://bbs.chinauni ...