Submission #953489

# Submission time Handle Problem Language Result Execution time Memory
953489 2024-03-26T03:24:05 Z Pacybwoah 양말 찾기 (KPI13_socks) C++17
0 / 1
2245 ms 65536 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 += 1000000001;
		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 - 1000000001);
 
	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]
    9 |  scanf("%d", &n);
      |  ~~~~~^~~~~~~~~~
socks.cpp:11:15: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   11 |   int x; scanf("%d", &x);
      |          ~~~~~^~~~~~~~~~
# 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 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 0 ms 600 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Runtime error 2245 ms 65536 KB Memory limit exceeded
12 Halted 0 ms 0 KB -