Submission #94696

# Submission time Handle Problem Language Result Execution time Memory
94696 2019-01-22T20:35:54 Z johnjq Pictionary (COCI18_pictionary) C++17
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
std::mt19937 rng(std::chrono::steady_clock::now().time_since_epoch().count());
typedef long long ll;
typedef unsigned long long ull;
typedef std::pair<int, int> ii;
using std::swap;

const int MAX_N = 100000;
#include "../codes/uf-partial-1.cpp"
#include "../codes/uf-partial-2.cpp"

bool same(int u, int v, int t) {
    return find(u, t) == find(v, t);
}

inline int find_time(int a, int b) {
    int ans = -1;
    int l = 0, r = tempo;
    while (l <= r) {
        const int m = (l+r)/2;
        if (same(a, b, m)) {
            ans = m;
            r = m-1;
        } else {
            l = m+1;
        }
    }
    return ans;
}

int32_t main() {
    using namespace std;
    ios::sync_with_stdio(false);
    cin.tie(0);
    init();

    int n, m, q;
    cin>>n>>m>>q;
    map<int, int> ans;
    ans[tempo] = 0;
    for (int day = m; day >= 1; --day) {
        for (int i = 2; i*day <= n; ++i) {
            if (!same(day, i*day, tempo))
                merge(day, i*day);
            else
                tempo += 1;
            ans[tempo] = m-day+1;
        }
    }
    while (q--) {
        int a, b;
        cin>>a>>b;
        int time = find_time(a, b);
        cout<<ans[time]<<'\n';
    }
}

Compilation message

pictionary.cpp:9:10: fatal error: ../codes/uf-partial-1.cpp: No such file or directory
 #include "../codes/uf-partial-1.cpp"
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.