Submission #47062

# Submission time Handle Problem Language Result Execution time Memory
47062 2018-04-27T05:43:27 Z kriii 양말 찾기 (KPI13_socks) C++17
0 / 1
2 ms 444 KB
#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

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 time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Incorrect 2 ms 444 KB Output isn't correct
6 Halted 0 ms 0 KB -