Submission #12774

# Submission time Handle Problem Language Result Execution time Memory
12774 2015-01-03T12:32:21 Z gs13068 양말 찾기 (KPI13_socks) C++
0 / 1
0 ms 1600 KB
#include<cstdio>

int d[2][65536];

int main()
{
    int i,n,a,b;
    scanf("%d",&n);
    while(n--)
	{
		scanf("%d",&i);
        d[0][i>>8]^=i;
        d[1][i&65535]^=i;
	}
	a=b=0;
	for(i=0;i<65536;i++)if(d[0][i])
	{
        if(a)b=d[0][i];
        else a=d[0][i];
	}
	if(!b)
	{
		a=b=0;
		for(i=0;i<65536;i++)if(d[1][i])
		{
			if(a)b=d[1][i];
			else a=d[1][i];
		}
	}
	if(a>b)a^=b^=a^=b;
	printf("%d %d",a,b);
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 1600 KB Output is correct
2 Correct 0 ms 1600 KB Output is correct
3 Correct 0 ms 1600 KB Output is correct
4 Correct 0 ms 1600 KB Output is correct
5 Runtime error 0 ms 1596 KB SIGSEGV Segmentation fault
6 Halted 0 ms 0 KB -