Submission #953141

# Submission time Handle Problem Language Result Execution time Memory
953141 2024-03-25T14:39:39 Z Pacybwoah 양말 찾기 (KPI13_socks) C++17
0 / 1
1 ms 344 KB
#include<cstdio>
using namespace std;
inline char readchar(){
	const int S = 1<<16;
	static char buf[S], *p = buf, *q = buf;
	return p == q and (q = (p = buf) + fread(buf, 1, S, stdin)) == buf ? EOF : *p++;
}
inline int R(int &a){
	static char c;
	while(((c = readchar()) < '0' or c > '9') and c != '-' and c != EOF);
	if(c == '-'){
		a = 0;
		while((c = readchar()) >= '0' and c <= '9') a *= 10, a -= c ^ '0';
	} else {
		a = c ^ '0';
		while((c = readchar()) >= '0' and c <= '9') a *= 10, a += c ^ '0';
	}
}
int arr[32][2];
int main(){
    int n;
    R(n);
    int x,i;
    for(i=0;i<32;i++) arr[i][0]=0,arr[i][1]=0;
    int j;
    for(i=0;i<n;i++){
        R(x);
        x+=1000000001;
        for(j=31;j>=0;j--){
            if(x&(1<<j)) arr[j][1]^=x;
            else arr[j][0]^=x;
        }
    }
    for(i=0;i<32;i++){
        if(arr[i][0]>0&&arr[i][1]>0){
            arr[i][0]-=1000000001;
            arr[i][1]-=1000000001;
            printf("%d %d\n",(arr[i][0]<arr[i][1]?arr[i][0]:arr[i][1]),(arr[i][1]>arr[i][0]?arr[i][1]:arr[i][0]));
            return 0;
        }
    }
}

Compilation message

socks.cpp: In function 'int R(int&)':
socks.cpp:18:1: warning: no return statement in function returning non-void [-Wreturn-type]
   18 | }
      | ^
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 344 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -