Submission #952900

# Submission time Handle Problem Language Result Execution time Memory
952900 2024-03-25T04:49:33 Z Darren0724 양말 찾기 (KPI13_socks) C++17
0 / 1
890 ms 65536 KB
#include <bits/stdc++.h>
using namespace std;
#define LCBorz ios_base::sync_with_stdio(false); cin.tie(0);
#define all(x) x.begin(), x.end()
#define endl '\n'
const int N=200005;
const int INF=1e9;
const int K=48000;
const int C=1.1e9;
int32_t main() {
    LCBorz;
    int n;cin>>n;
    int v[K]{},v1[K]{};
    int p;
    for(int i=0;i<n;i++){
        cin>>p;
        p+=C;
        v[p%K]^=p;
        v1[p/K]^=p;
    }
    int cnt1=0;
    for(int i=0;i<K;i++){
        cnt1+=(v[i]>0);
    }
    vector<int> ans;
    if(cnt1==2){
        for(int i=0;i<K;i++){
            if(v[i])ans.push_back(v[i]-C);
        }
        sort(all(ans));
        cout<<ans[0]<<' '<<ans[1]<<endl;
        return 0;
    }
    for(int i=0;i<K;i++){
        if(v1[i])ans.push_back(v1[i]-C);
    }
    sort(all(ans));
    cout<<ans[0]<<' '<<ans[1]<<endl;

    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 600 KB Output is correct
2 Correct 1 ms 600 KB Output is correct
3 Correct 1 ms 604 KB Output is correct
4 Correct 1 ms 600 KB Output is correct
5 Correct 1 ms 600 KB Output is correct
6 Correct 1 ms 604 KB Output is correct
7 Correct 1 ms 604 KB Output is correct
8 Correct 1 ms 604 KB Output is correct
9 Correct 1 ms 604 KB Output is correct
10 Correct 1 ms 600 KB Output is correct
11 Correct 890 ms 800 KB Output is correct
12 Correct 839 ms 808 KB Output is correct
13 Runtime error 885 ms 65536 KB Memory limit exceeded
14 Halted 0 ms 0 KB -