# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
949787 |
2024-03-19T17:41:01 Z |
rainboy |
양말 찾기 (KPI13_socks) |
C |
|
1 ms |
504 KB |
#include <ctype.h>
#include <stdio.h>
#define L 31 /* L = ceil(log2(2 * 10^9 + 1)) */
int read() {
char c;
int a, sgn;
while (1)
if (!isdigit(c = getchar()) || c == '-')
break;
sgn = 1;
if (c == '-')
sgn = -1, c = getchar();
a = 0;
for ( ; isdigit(c); c = getchar())
a = a * 10 + c - '0';
a *= sgn;
return a;
}
int main() {
static int xx[L];
int n, l, a, b, x, tmp;
n = read();
x = 0;
while (n--) {
a = read();
x ^= a;
for (l = 0; l < L; l++)
if ((a & 1 << l) != 0)
xx[l] ^= a;
}
a = 0, b = x;
for (l = 0; l < L; l++)
if (xx[l] != 0 && xx[l] != x) {
a = xx[l], b = x ^ xx[l];
break;
}
if (a > b)
tmp = a, a = b, b = tmp;
printf("%d %d\n", a, b);
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
504 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |