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. 使用bootstrapvalidator的remote验证经验

    这里需要说一下,bootstrapvalidator的帮助文档写的比较简单,对于remote验证器的说明更是如此,在经历多方测试之后才明白如何使用这个验证器. 一个典型的ajax验证代码如下: 服务端 ...

  2. Android SQLite的使用2(非原创)

    1.数据库的增.删.改.查:execSQL方法 public void insertAction() {//添加信息 db.execSQL("insert into Emp(name,sal ...

  3. Byte、KB、MB、GB、TB、PB、EB是啥以及它们之间的进率

    它们是存储单位 因为计算机存储单位一般用B,KB.MB.GB.TB.PB.EB.ZB.YB.BB来表示,它们之间的关系是: 位 bit (比特)(Binary Digits):存放一位二进制数,即 0 ...

  4. JavaScript获取css 行间样式,内连样式和外链样式的方式

    [行间样式获取] <div id='div1' style="backgroud:red">测试</div> <script> var odiv ...

  5. 图的广度、深度优先遍历 C语言

    以下是老师作为数据结构课的作业的要求,没有什么实际用处和可以探讨和总结的的地方,所以简单代码直接展示. 宽度优先遍历: #include<cstdio> #include<iostr ...

  6. fddd

    <script language="JavaScript" type="text/javascript"> function exportChart ...

  7. CSS3实现时间表

    一直想学CSS3,今天别的论坛看到的例子,挺好,mark起来以后自己看. <!doctype html> <html> <head> <meta charse ...

  8. 整不明白Jquery的问题

    最近写个GridView,由于不是很熟悉javascript,用jquery实现后,发现下面设置左右表行高的代码如果不把行保存在$tr1,$tr2中再设置css,速度非常慢,300行50列左右的数据得 ...

  9. JS的全局变量&局部变量

    <script> var i=10; //全局变量 j = 20; //全局变量 function(){ var i=30; //局部变量 h = 40; //全局变量 } </sc ...

  10. https://github.com/aptana/studio3/releases aptana

    https://github.com/aptana/studio3/releases  aptana