結果
| 問題 |
No.488 四角関係
|
| ユーザー |
a01sa01to
|
| 提出日時 | 2025-07-08 00:46:53 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 4,412 ms / 5,000 ms |
| コード長 | 1,050 bytes |
| コンパイル時間 | 5,897 ms |
| コンパイル使用メモリ | 292,028 KB |
| 実行使用メモリ | 46,848 KB |
| 最終ジャッジ日時 | 2025-07-08 00:47:05 |
| 合計ジャッジ時間 | 10,183 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 22 |
ソースコード
#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<vector<int>> ans, mans;
rep(u, n) rep(v, n) rep(w, n) {
if (u == v || u == w || v == w) continue;
if (!Graph[u][v] || !Graph[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[w][x] && Graph[x][u]) {
vector<int> cycle = { u, v, w, x };
sort(cycle.begin(), cycle.end());
ans.insert(cycle);
if (flg) mans.insert(cycle);
}
}
}
for (auto& c : mans) ans.erase(c);
cout << ans.size() << '\n';
return 0;
}
a01sa01to