Submission #467334

#TimeUsernameProblemLanguageResultExecution timeMemory
467334phathnvPastiri (COI20_pastiri)C++11
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #include "testlib.h" using namespace std; const int N = 500007; int n, k, d[N], trace[N], numNode; vector<int> adj[N], sheep, child[2 * N]; bool vst[N]; int main() { cin >> n >> k; for (int i = 1; i < n; i++) { int u, v; cin >> u >> v; adj[u].push_back(v); adj[v].push_back(u); } sheep.assign(k, 0); for (int &x : sheep) cin >> x; for (int i = 1; i <= n; i++) d[i] = 1e9; queue<int> qu; for (int x : sheep) { d[x] = 0; trace[x] = ++numNode; qu.push(x); } while (!qu.empty()) { int u = qu.front(); qu.pop(); for (int v : adj[u]) { if (d[v] > d[u] + 1) { d[v] = d[u] + 1; trace[v] = trace[u]; qu.push(v); } else if (d[v] == d[u] + 1) { int newNode = ++numNode; child[newNode].push_back(trace[u]); child[newNode].push_back(trace[v]); trace[v] = newNode; } } } map<int, int> nodeToVex; for (int i = 1; i <= n; i++) nodeToVex[trace[i]] = i; vector<int> answer; for (int i = 1; i <= numNode; i++) for (int v : child[i]) vst[v] = true; for (int i = 1; i <= numNode; i++) if (!vst[i]) answer.push_back(nodeToVex[i]); cout << answer.size() << '\n'; for (int x : answer) cout << x << ' '; cout << '\n'; }

Compilation message (stderr)

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