# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
432108 | 2021-06-17T21:06:55 Z | SuhaibSawalha1 | Duathlon (APIO18_duathlon) | C++17 | 3 ms | 332 KB |
#include <bits/stdc++.h> using namespace std; int n, m, nodes, vid, found; vector<vector<int>> adj; vector<int> vis; long long ans; void dfs (int u, int t, int k, bool ok = 0) { if (found) { return; } vis[u] = vid; if (u == k) { found = ok; ans += ok; } ok |= u == t; for (int v : adj[u]) { if (vis[v] != vid) { dfs(v, t, k, ok); } } vis[u] = 0; } int main (){ #ifndef ONLINE_JUDGE freopen("SuhaibSawalha1","r",stdin); #endif ios_base::sync_with_stdio(false); cin.tie(NULL); cin >> n >> m; adj.resize(n); while (m--) { int u, v; cin >> u >> v, --u, --v; adj[u].push_back(v); adj[v].push_back(u); } vis.resize(n); for (int u = 0; u < n; ++u) { for (int v = 0; v < n; ++v) { for (int k = 0; k < n; ++k) { if (set<int>{u, v, k}.size() == 3) { ++vid; found = 0; dfs(u, v, k); } } } } cout << ans; return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 332 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 332 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 3 ms | 332 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 3 ms | 332 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 332 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 332 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 332 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 332 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 332 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |