답안 #572536

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
572536 2022-06-04T16:27:53 Z MohamedFaresNebili 정렬하기 (IOI15_sorting) C++14
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h>
#include "sorting.h"
#include <ext/pb_ds/assoc_container.hpp>

        using namespace std;
        using namespace __gnu_pbds;

        using ll = long long;
        using ii = pair<int, int>;
        using vi = vector<int>;

        #define pb push_back
        #define pp pop_back
        #define ff first
        #define ss second
        #define lb lower_bound
        #define all(x) (x).begin(), (x).end()

        typedef tree<int, null_type, less<int>, rb_tree_tag,
            tree_order_statistics_node_update> indexed_set;

        vector<ii> ans, ve;
        bool can(int N, int S[], int M, int X[], int Y[]) {
            ve.clear();
            int s[N], pos[N], res[N], arr[N], a[N], x[M], y[M];
            for(int l = 0; l < N; l++) {
                res[l] = l, arr[l] = l; a[l] = l;
                s[l] = S[l]; pos[s[l]] = l;
            }
            for(int l = 0; l < M; l++) {
                x[l] = X[l], y[l] = Y[l];
                swap(res[x[l]], res[y[l]]);
            }
            int c = 0;
            for(int l = 0; l < N; l++) {
                if(res[l] == pos[l]) continue;
                int i = X[c], j = Y[c];
                swap(arr[i], arr[j]);
                swap(a[arr[i]], a[arr[j]]);

                ve.pb({a[pos[l]], a[res[l]]});
                swap(pos[l], pos[s[res[l]]]);
                swap(s[pos[l]], s[res[l]]);
                c++;
            }
            if(c > M) return 0;
            for(int l = c; l < M; l++) ve.pb({0, 0});
            return 1;
        }

Compilation message

/usr/bin/ld: /tmp/cchOQMuO.o: in function `main':
grader.c:(.text.startup+0x4eb): undefined reference to `findSwapPairs(int, int*, int, int*, int*, int*, int*)'
collect2: error: ld returned 1 exit status