Submission #294887

#TimeUsernameProblemLanguageResultExecution timeMemory
294887ASDF123Arranging Shoes (IOI19_shoes)C++17
Compilation error
0 ms0 KiB
#include "shoes.h" #include <bits/stdc++.h> #define int long long using namespace std; const int N = (int)2e5 + 5; int s[N]; int tree[N * 4]; void upd(int pos, int val, int v = 0, int tl = 0, int tr = N) { if (tl == tr) { tree[v] += val; return; } int mid = (tl + tr) >> 1; if (pos <= mid) { upd(pos, val, v + v + 1, tl, mid); } else { upd(pos, val, v + v + 2, mid + 1, tr); } tree[v] = tree[v + v + 1] + tree[v + v + 2]; } int get(int l, int r, int v = 0, int tl = 0, int tr = N) { if (l <= tl && tr <= r) { return tree[v]; } if (l > tr || tl > r) { return 0; } int mid = (tl + tr) >> 1; return get(l, r, v + v + 1, tl, mid) + get(l, r, v + v + 2, mid + 1, tr); } long long count_swaps(std::vector<int> s) { int n = (int)s.size() / 2; long long ans = 0; for (int i = 0; i < n * 2; i++) { int pos; if (s[i] > 0) { pos = s[i] * 2 - 1; } else { pos = -s[i] * 2 - 2; } upd(pos, 1); ans += get(pos + 1, 2 * n - 1); } return ans; }

Compilation message (stderr)

/tmp/cc2vB3L3.o: In function `main':
grader.cpp:(.text.startup+0x27a): undefined reference to `count_swaps(std::vector<int, std::allocator<int> >)'
collect2: error: ld returned 1 exit status