Submission #47062

#TimeUsernameProblemLanguageResultExecution timeMemory
47062kriii양말 찾기 (KPI13_socks)C++17
0 / 1
2 ms444 KiB
#include <stdio.h> #include <set> using namespace std; int n,v[31]; int main() { scanf("%d", &n); for (int i = 0; i < n; i++) { int x; scanf("%d", &x); x += 1000000000; for (int j = 0; j < 31; j++) if (x & (1 << j)) v[j] ^= x; } set<int> ans; int u = 0; for (int j = 0; j < 31; j++) { if (v[j] & (1 << j)) ans.insert(v[j]); else if (v[j]) u = v[j]; } if (ans.size() == 1) ans.insert(u^*ans.begin()); for (auto &x : ans) printf("%d ", x - 1000000000); return 0; }

Compilation message (stderr)

socks.cpp: In function 'int main()':
socks.cpp:9:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d", &n);
  ~~~~~^~~~~~~~~~
socks.cpp:11:15: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   int x; scanf("%d", &x);
          ~~~~~^~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...