Submission #576114

#TimeUsernameProblemLanguageResultExecution timeMemory
576114SlavicGCarnival Tickets (IOI20_tickets)C++17
Compilation error
0 ms0 KiB
#include "bits/stdc++.h"
#include "supertrees.h"
using namespace std;

#define ll long long
#define sz(a) (int)a.size()
#define pb push_back
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define forn(i, n) for(int i=0;i < n; ++i)
const int N = 1005;
int par[N], ways[N][N];
bool ok = true;
int get(int a) {
    return par[a] = (par[a] == a ? a : get(par[a]));
}

void uni(int a, int b) {
    a = get(a);
    b = get(b);
    par[a] = b;
}

vector<int> adj[N];
int construct(std::vector<std::vector<int>> p) {
	int n = p.size();
	forn(i, n) forn(j, n) if(p[i][j] == 3) return 0;
	forn(i, n) par[i] = i;
	std::vector<std::vector<int>> answer(n, vector<int>(n, 0));

    for(int i = 0; i < n; ++i) {
        for(int j = i + 1; j < n; ++j) {
            if(p[i][j] == 1 && get(i) != get(j)) {
                answer[i][j] = answer[j][i] = 1;
                uni(i, j);
            }
        }
    }

    for(int i = 0; i < n; ++i) {
        vector<int> v;
        v.pb(i);
        for(int j = i + 1; j < n; ++j) {
            if(get(i) != get(j) && p[get(i)][get(j)] == 2) {
                v.pb(j);
                uni(i, j);
            }
        }
        if(sz(v) >= 2) {
            for(int k = 0; k < sz(v); ++k) {
                answer[v[k]][v[(k + 1) % sz(v)]] = answer[v[(k + 1) % sz(v)]][v[k]] = 1;
            }
        }
    }

    for(int i = 0; i < n; ++i) {
        for(int j = i + 1; j < n; ++j) {
            if(answer[i][j]) {
                adj[i].pb(j);
                adj[j].pb(i);
            }
        }
    }

    forn(i, n) {
        forn(j, n) {
            if(get(i) == get(j) && !p[i][j]) return 0;
            if(get(i) != get(j) && p[i][j]) return 0;
        }
    }
	build(answer);
	return 1;
}

Compilation message (stderr)

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