Submission #433058

#TimeUsernameProblemLanguageResultExecution timeMemory
433058timmyfengHorses (IOI15_horses)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; #include "sorting.h" const int N = 200000; int perm[N], inv[N], first[N], second[N]; bool visited[N]; int findSwapPairs(int N, int S[], int M, int X[], int Y[], int P[], int Q[]) { int low = 0, high = M + 1; while (low < high) { int mid = (low + high) / 2; copy(S, S + N, perm); for (int i = 0; i < mid; ++i) { swap(perm[X[i]], perm[Y[i]]); } int count = 0; fill(visited, visited + N, false); fill(first, first + N, 0); fill(second, second + N, 0); for (int i = 0; i < N; ++i) { while (perm[i] != i) { first[count] = perm[i], second[count] = perm[perm[i]], ++count; swap(perm[i], perm[perm[i]]); } } if (count <= mid) { high = mid; copy(S, S + N, perm); for (int i = 0; i < N; ++i) { inv[perm[i]] = i; } for (int i = 0; i < mid; ++i) { swap(perm[X[i]], perm[Y[i]]); swap(inv[perm[X[i]]], inv[perm[Y[i]]]); P[i] = first[i], Q[i] = second[i]; swap(inv[P[i]], inv[Q[i]]); P[i] = inv[P[i]], Q[i] = inv[Q[i]]; swap(perm[P[i]], perm[Q[i]]); } } else { low = mid + 1; } } return low; }

Compilation message (stderr)

horses.cpp:4:10: fatal error: sorting.h: No such file or directory
    4 | #include "sorting.h"
      |          ^~~~~~~~~~~
compilation terminated.