結果
問題 |
No.488 四角関係
|
ユーザー |
![]() |
提出日時 | 2025-07-08 00:40:23 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 984 bytes |
コンパイル時間 | 4,172 ms |
コンパイル使用メモリ | 290,624 KB |
実行使用メモリ | 21,376 KB |
最終ジャッジ日時 | 2025-07-08 00:40:36 |
合計ジャッジ時間 | 10,815 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | -- * 3 |
other | AC * 8 TLE * 1 -- * 13 |
ソースコード
#include <bits/stdc++.h> using namespace std; #ifdef LOCAL #include "settings/debug.cpp" #else #define Debug(...) void(0) #endif #define rep(i, n) for (int i = 0; i < (n); ++i) using ll = long long; using ull = unsigned long long; int main() { cin.tie(nullptr)->sync_with_stdio(false); int n, m; cin >> n >> m; vector Graph(n, vector<bool>(n, false)); rep(_, m) { int u, v; cin >> u >> v; Graph[u][v] = Graph[v][u] = true; } set<set<int>> ans, mans; rep(u, n) rep(v, n) rep(w, n) { if (u == v || u == w || v == w) continue; bool flg = false; if (Graph[u][v] && Graph[v][w] && Graph[w][u]) flg = true; rep(x, n) { if (x == u || x == v || x == w) continue; if (Graph[u][v] && Graph[v][w] && Graph[w][x] && Graph[x][u]) { set<int> cycle = { u, v, w, x }; ans.insert(cycle); if (flg) mans.insert(cycle); } } } for (auto& c : mans) ans.erase(c); cout << ans.size() << '\n'; return 0; }