結果
問題 | No.488 四角関係 |
ユーザー |
|
提出日時 | 2017-02-24 22:29:54 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 840 ms / 5,000 ms |
コード長 | 763 bytes |
コンパイル時間 | 761 ms |
コンパイル使用メモリ | 76,492 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2025-01-02 22:56:22 |
合計ジャッジ時間 | 6,650 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 22 |
ソースコード
#include <iostream> #include <cstdio> #include <algorithm> #include <string> #include <vector> #include <set> #include <map> using namespace std; int g[50][50]; int main() { int n, m; cin >> n >> m; for (int i = 0; i < m; i++) { int u, v; cin >> u >> v; g[u][v] = true; g[v][u] = true; } int ans = 0; for (int i = 0; i < n; i++) { for (int j = 0; j < n; j++) { for (int k = 0; k < n; k++) { for (int l = 0; l < n; l++) { set<int> st; st.insert(i); st.insert(j); st.insert(k); st.insert(l); if (st.size() < 4) { continue; } if (g[i][k] || g[j][l]) { continue; } if (g[i][j] && g[j][k] && g[k][l] && g[l][i]) { ans++; } } } } } cout << ans / 8 << endl; }