Submission #949797

#TimeUsernameProblemLanguageResultExecution timeMemory
949797rainboy양말 찾기 (KPI13_socks)C++17
0 / 1
1638 ms10508 KiB
#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 (stderr)

socks.cpp: In function 'int main()':
socks.cpp:12:16: warning: suggest parentheses around '&&' within '||' [-Wparentheses]
   12 |   if (c >= '0' && c <= '9' || c == '-')
      |       ~~~~~~~~~^~~~~~~~~~~
socks.cpp:26:17: warning: suggest parentheses around '&&' within '||' [-Wparentheses]
   26 |    if (c >= '0' && c <= '9' || c == '-')
      |        ~~~~~~~~~^~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...