# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
949796 |
2024-03-19T17:54:24 Z |
rainboy |
양말 찾기 (KPI13_socks) |
C |
|
1741 ms |
10364 KB |
#include <stdio.h>
#define L 31 /* L = ceil(log2(2 * 10^9 + 1)) */
int main() {
static int xx[L];
int n, l, a, b, x, sgn, tmp;
char c;
while (1) {
c = getchar();
if (c >= '0' && c <= '9' || c == '-')
break;
}
sgn = 1;
if (c == '-')
sgn = -1, c = getchar();
n = 0;
for ( ; c >= '0' && c <= '9'; c = getchar())
n = n * 10 + c - '0';
n *= sgn;
x = 0;
while (n--) {
while (1) {
c = getchar();
if (c >= '0' && c <= '9' || c == '-')
break;
}
sgn = 1;
if (c == '-')
sgn = -1, c = getchar();
a = 0;
for ( ; c >= '0' && c <= '9'; c = getchar())
a = a * 10 + c - '0';
a *= sgn;
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;
}
Compilation message
socks.c: In function 'main':
socks.c:12:16: warning: suggest parentheses around '&&' within '||' [-Wparentheses]
12 | if (c >= '0' && c <= '9' || c == '-')
| ~~~~~~~~~^~~~~~~~~~~
socks.c:26:17: warning: suggest parentheses around '&&' within '||' [-Wparentheses]
26 | if (c >= '0' && c <= '9' || c == '-')
| ~~~~~~~~~^~~~~~~~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
1 ms |
348 KB |
Output is correct |
5 |
Correct |
1 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
1 ms |
348 KB |
Output is correct |
9 |
Correct |
0 ms |
348 KB |
Output is correct |
10 |
Correct |
0 ms |
348 KB |
Output is correct |
11 |
Correct |
1692 ms |
348 KB |
Output is correct |
12 |
Correct |
1741 ms |
392 KB |
Output is correct |
13 |
Correct |
1690 ms |
392 KB |
Output is correct |
14 |
Correct |
35 ms |
348 KB |
Output is correct |
15 |
Correct |
39 ms |
348 KB |
Output is correct |
16 |
Correct |
62 ms |
348 KB |
Output is correct |
17 |
Correct |
169 ms |
392 KB |
Output is correct |
18 |
Correct |
2 ms |
348 KB |
Output is correct |
19 |
Correct |
0 ms |
348 KB |
Output is correct |
20 |
Runtime error |
178 ms |
10364 KB |
Memory limit exceeded |
21 |
Halted |
0 ms |
0 KB |
- |