Submission #159451

#TimeUsernameProblemLanguageResultExecution timeMemory
159451MinnakhmetovDuathlon (APIO18_duathlon)C++14
0 / 100
4 ms504 KiB
#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)

count_triplets.cpp: In function 'int main()':
count_triplets.cpp:40:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)', declared with attribute warn_unused_result [-Wunused-result]
     freopen("input.txt", "r", stdin);
     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
count_triplets.cpp:41:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)', declared with attribute warn_unused_result [-Wunused-result]
     freopen("output_slow.txt", "w", stdout);
     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#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...