제출 #1043276

#제출 시각아이디문제언어결과실행 시간메모리
1043276vjudge1철인 이종 경기 (APIO18_duathlon)C++17
16 / 100
1049 ms1476 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; const int N = 105; int n, m; vector<int> g[N]; bool vis[N], possible[N][N][N]; void dfs(int v, int y, int z){ if (v == z) return; vis[v] = 1; for (int u : g[v]) if (!vis[u]) dfs(u, y, z); } int main(){ cin >> n >> m; for (int i = 0; i < m; i ++){ int u, v; cin >> u >> v; g[u].push_back(v); g[v].push_back(u); } int total = n * (n - 1) * (n - 2); for (int u = 1; u <= n; u ++){ for (int v = 1; v <= n; v ++){ for (int e = 1; e <= n; e ++){ memset(vis, 0, sizeof vis); dfs(u, v, e); if (vis[v]) possible[u][v][e] = 1; } } } for (int c = 1; c <= n; c ++){ for (int s = 1; s <= n; s ++){ for (int f = 1; f <= n; f ++){ if (c == s or c == f or s == f) continue; bool bad = 0; for (int v = 1; v <= n; v ++){ if (v == c) continue; if (!possible[s][c][v] and !possible[c][f][v]) bad = 1; } total -= bad; } } } cout << total << endl; }
#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...