Submission #964023

#TimeUsernameProblemLanguageResultExecution timeMemory
964023four_specksPipes (CEOI15_pipes)C++17
0 / 100
846 ms65536 KiB
#include <bits/stdc++.h> using namespace std; namespace { template <typename Fun> struct YCombinator { template <typename T> YCombinator(T &&_fun) : fun(forward<T>(_fun)) {} template <typename... Args> decltype(auto) operator()(Args &&...args) { return fun(ref(*this), forward<Args>(args)...); } private: Fun fun; }; template <typename T> YCombinator(T &&) -> YCombinator<decay_t<T>>; struct DSU { DSU(int n) : e(n, -1) {} int find(int x) { return e[x] < 0 ? x : e[x] = find(e[x]); } bool same(int x, int y) { return find(x) == find(y); } bool unite(int x, int y) { x = find(x); y = find(y); if (x == y) { return false; } if (e[x] > e[y]) { swap(x, y); } e[x] += e[y]; e[y] = x; return true; } int size(int x) { return -e[find(x)]; } int size() const { return (int)e.size(); } private: vector<int> e; }; } // namespace void solve() { int n, m; cin >> n >> m; vector<vector<pair<int, int>>> adj(n); DSU dsu1(n), dsu2(n); for (int i = 0; i < m; i++) { int u, v; cin >> u >> v; --u; --v; if (dsu1.unite(u, v) || dsu2.unite(u, v)) { adj[u].emplace_back(v, i); adj[v].emplace_back(u, i); } } { vector<int> tin(n, -1), low(n); int timer = 0; // YCombinator([&](auto self, int u, int p) -> void { // tin[u] = timer++; // low[u] = tin[u]; // for (int v : adj[u]) { // if (tin[v] == -1) { // self(v, u); // } else { // } // } // })(0, -1); } } int main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); solve(); return 0; }

Compilation message (stderr)

pipes.cpp: In function 'void solve()':
pipes.cpp:80:9: warning: unused variable 'timer' [-Wunused-variable]
   80 |     int timer = 0;
      |         ^~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...