Submission #579091

#TimeUsernameProblemLanguageResultExecution timeMemory
579091MohamedFaresNebiliGondola (IOI14_gondola)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h>
#include "gondola.h"
#include <ext/pb_ds/assoc_container.hpp>

        using namespace std;
        using namespace __gnu_pbds;

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

        #define pb push_back
        #define pp pop_back
        #define ff first
        #define ss second
        #define int ll

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

        int valid(int n, int arr[]) {
            bool vis[250005];
            memset(vis, 0, sizeof vis);
            for(int l = 0; l < n; l++) {
                if(vis[arr[l]]) return 0;
                vis[arr[l]] = 1;
            }
            int P = -1;
            for(int l = 0; l < n; l++) {
                if(arr[l] > n) continue;
                int K = arr[l] - l + n * 2; K %= n;
                if(P == -1) P = K;
                if(K != P) return 0;
            }
            return 1;
        }

        //----------------------

        int replacement(int n, int arr[], int replacementSeq[]) {
            ii A[n]; int l = 0;
            while(l < n && arr[l] > n) l++;
            if(l == n) {
                for(l = 0; l < n; l++)
                    A[l] = {arr[l], l};
            }
            else {
                int V = arr[l];
                for(int i = 0; i < n; l = (l + 1) % n, i++) {
                    A[l] = {arr[l], V};
                    V = (V % n) + 1;
                }
            }
            sort(A, A + n); int curr = n + 1; int res = 0;
            for(auto E : A) {
                int U = E.ff, V = E.ss;
                while(U != V) {
                    replacementSeq[res++] = V;
                    V = curr; curr++;
                }
            }
            return res;
        }

        //----------------------

        int countReplacement(int n, int inputSeq[]) {

        }

Compilation message (stderr)

gondola.cpp: In function 'll countReplacement(ll, ll*)':
gondola.cpp:68:9: warning: no return statement in function returning non-void [-Wreturn-type]
   68 |         }
      |         ^
/usr/bin/ld: /tmp/ccJu9FH5.o: in function `main':
grader.cpp:(.text.startup+0xb6): undefined reference to `valid'
/usr/bin/ld: grader.cpp:(.text.startup+0x108): undefined reference to `countReplacement'
/usr/bin/ld: grader.cpp:(.text.startup+0x132): undefined reference to `replacement'
collect2: error: ld returned 1 exit status