# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
159451 | Minnakhmetov | Duathlon (APIO18_duathlon) | C++14 | 4 ms | 504 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
#define ll long long
#define all(aaa) aaa.begin(), aaa.end()
using namespace std;
const int N = 105;
vector<int> g[N];
bool used[N];
int n, m;
vector<int> pt;
set<vector<int>> st;
void dfs(int node, int len) {
used[node] = 1;
pt.push_back(node);
for (int i = 1; i < (int)pt.size() - 1; i++) {
st.insert({pt[0], pt[i], pt.back()});
}
for (int to : g[node]) {
if (!used[to])
dfs(to, len + 1);
}
pt.pop_back();
used[node] = 0;
}
signed main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
freopen("input.txt", "r", stdin);
freopen("output_slow.txt", "w", stdout);
cin >> n >> m;
for (int i = 0; i < m; i++) {
int a, b;
cin >> a >> b;
a--, b--;
g[a].push_back(b);
g[b].push_back(a);
}
for (int i = 0; i < n; i++) {
dfs(i, 1);
}
cout << st.size();
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |