답안 #952926

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
952926 2024-03-25T05:17:16 Z browntoad 양말 찾기 (KPI13_socks) C++14
0 / 1
1 ms 348 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){
        scanf("%d", x);
        x += 1000000049;
        //assert(x <= 1000000000);
        toadp[x/bloc] ^= x;
        toadm[x%bloc] ^= x;
    }

    int dif = 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:29:17: warning: format '%d' expects argument of type 'int*', but argument 2 has type 'int' [-Wformat=]
   29 |         scanf("%d", x);
      |                ~^   ~
      |                 |   |
      |                 |   int
      |                 int*
socks.cpp:29:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   29 |         scanf("%d", x);
      |         ~~~~~^~~~~~~~~
socks.cpp:27:9: warning: 'x' may be used uninitialized in this function [-Wmaybe-uninitialized]
   27 |     int x;
      |         ^
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 348 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -