Submission #953120

# Submission time Handle Problem Language Result Execution time Memory
953120 2024-03-25T14:23:29 Z Pacybwoah 양말 찾기 (KPI13_socks) C++17
0 / 1
4152 ms 65536 KB
#include<iostream>
using namespace std;
int arr[32][2];
int main(){
    int n;
    cin>>n;
    int x;
    for(int i=0;i<32;i++) arr[i][0]=0,arr[i][1]=0;
    int j;
    for(int i=0;i<n;i++){
        cin>>x;
        x+=1000000001;
        for(j=31;j>=0;j--){
            if(x&(1<<j)) arr[j][1]^=x;
            else arr[j][0]^=x;
        }
    }
    for(int i=0;i<32;i++){
        if(arr[i][0]>0&&arr[i][1]>0){
            arr[i][0]-=1000000001;
            arr[i][1]-=1000000001;
            cout<<(arr[i][0]<arr[i][1]?arr[i][0]:arr[i][1])<<" "<<(arr[i][1]>arr[i][0]?arr[i][1]:arr[i][0])<<"\n";
            return 0;
        }
    }
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 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 344 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 0 ms 348 KB Output is correct
9 Correct 1 ms 344 KB Output is correct
10 Correct 0 ms 344 KB Output is correct
11 Runtime error 4152 ms 65536 KB Memory limit exceeded
12 Halted 0 ms 0 KB -