Submission #952911

# Submission time Handle Problem Language Result Execution time Memory
952911 2024-03-25T05:01:22 Z browntoad 양말 찾기 (KPI13_socks) C++14
0 / 1
2985 ms 10832 KB
#include <bits/stdc++.h>
using namespace std;
#define ll long long
// #define int ll
#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define REP(i, n) FOR(i, 0, n)
#define REP1(i, n) FOR(i, 1, n+1)
#define RREP(i, n) for (int i = (n)-1; i >= 0; i--)
#define pii pair<int, int>
#define ppi pair<pii, int>
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) (int)((x).size())
#define f first
#define s second
#define pb push_back
//#define endl '\n'
#define IOS() ios::sync_with_stdio(false), cin.tie(0), cout.tie(0)

const ll maxn = 1e6+5;
const ll bloc = 63000;

int toadp[bloc];
int toadm[bloc];
signed main(){
    // IOS();
    int n; cin>>n;
    int x;
    REP(i, n){
        cin>>x;
        x += 1000000049;
        //assert(x <= 1000000000);
        toadp[x/bloc] ^= x;
        toadm[x%bloc] ^= x;
    }

    int dif = 0, xr = 0;
    REP(i, bloc){
        if (toadp[i] > 0){
            dif++;
        }
    }
    if (dif == 2){
        REP(i, bloc){
            if (toadp[i] > 0) cout<<toadp[i]-1000000049<<' ';
        }
        cout<<endl;
    }
    else {
        REP(i, bloc){
            if (toadm[i] > 0) cout<<toadm[i]-1000000049<<' ';
        }
        cout<<endl;
    }
}

Compilation message

socks.cpp: In function 'int main()':
socks.cpp:36:18: warning: unused variable 'xr' [-Wunused-variable]
   36 |     int dif = 0, xr = 0;
      |                  ^~
# 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 1 ms 348 KB Output is correct
4 Correct 1 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 348 KB Output is correct
10 Correct 1 ms 604 KB Output is correct
11 Correct 2923 ms 784 KB Output is correct
12 Correct 2912 ms 788 KB Output is correct
13 Correct 2985 ms 856 KB Output is correct
14 Correct 112 ms 424 KB Output is correct
15 Correct 106 ms 348 KB Output is correct
16 Correct 275 ms 344 KB Output is correct
17 Runtime error 293 ms 10832 KB Memory limit exceeded
18 Halted 0 ms 0 KB -