Submission #684580

#TimeUsernameProblemLanguageResultExecution timeMemory
684580stevancvJousting tournament (IOI12_tournament)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h>
#include "tournament.h"
#define ll long long
#define ld long double
#define sp ' '
#define en '\n'
#define smin(a, b) a = min(a, b)
#define smax(a, b) a = max(a, b)
using namespace std;
const int N = 1e5 + 2;
const int inf = 1e9;
int l[N], r[N], ans[N];
struct Bit {
    int bit[N];
    void Add(int x, int y) {
        x += 1;
        for (; x < N; x += x & (-x)) bit[x] += y;
    }
    int Get(int x) {
        x += 1;
        int ans = 0;
        for (; x > 0; x -= x & (-x)) ans += bit[x];
        return ans;
    }
}f;
vector<int> b;
bool Has(int x, int y) {
    auto it = lower_bound(b.begin(), b.end(), x);
    if (it == b.end()) return false;
    return *it < y;
}
int GetBestPosition(int n, int q, int k, int *p, int *s, int *e) {
    for (int i = 0; i < n - 1; i++) if (p[i] > k) b.push_back(i);
    for (int i = 0; i < n; i++) l[i] = r[i] = i;
    for (int i = 0; i < q; i++) {
        int idx = s[i] + f.Get(s[i]); int idy = e[i] + f.Get(e[i]);
        r[idx] = r[idy];
        f.Add(l[idx] + 1, e[i] - s[i]);
        if (!Has(l[idx], r[idy])) {
            ans[l[idx]]++;
            ans[r[idy] + 1]--;
        }
    }
    int pos = 0;
    for (int i = 0; i < n; i++) {
        if (i > 0) ans[i] += ans[i - 1];
        if (ans[i] > ans[pos]) pos = i;
    }
    return pos;
}

Compilation message (stderr)

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