Submission #432119

#TimeUsernameProblemLanguageResultExecution timeMemory
432119SuhaibSawalha1Duathlon (APIO18_duathlon)C++17
0 / 100
3 ms332 KiB
#include <bits/stdc++.h> using namespace std; int n, m; vector<vector<int>> adj; bitset<50> st, stck; long long ans; void dfs (int u, int k) { if (u == k) { st |= stck; } stck[u] = 1; for (int v : adj[u]) { if (!stck[v]) { dfs(v, k); } } stck[u] = 0; } int main (){ ios_base::sync_with_stdio(false); cin.tie(NULL); freopen("SuhaibSawalha1","r",stdin); 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); } for (int u = 0; u < n; ++u) { for (int v = 0; v < n; ++v) { if (u ^ v) { dfs(u, v); ans += max(0, (int)st.count() - 1); st.reset(); } } } cout << ans; return 0; }

Compilation message (stderr)

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