結果

問題 No.488 四角関係
ユーザー k
提出日時 2020-07-18 16:16:38
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 8 ms / 5,000 ms
コード長 702 bytes
コンパイル時間 1,821 ms
コンパイル使用メモリ 193,184 KB
最終ジャッジ日時 2025-01-12 00:18:43
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 22
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

#define REP(i,n) for(int i=0; i<(int)(n); i++)

bool edge[50][50];

int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);

  int n, m;
  cin >> n >> m;

  REP (i, m) {
    int u, v;
    cin >> u >> v;
    edge[u][v] = edge[v][u] = 1;
  }
  
  int ret = 0;
  REP (a, n) REP (b, n) {
    if (a == b) continue;
    if (!edge[a][b]) continue;
    REP (c, n) {
      if (c == a || c == b) continue;
      if (!edge[a][c] || edge[b][c]) continue;

      REP (d, n) {
        if (d == a || d == b || d == c) continue;
        if (edge[b][d] && edge[c][d] && !edge[a][d])
          ++ret;
      }
    }

  }

  
  cout << ret / 8  << endl;
  
  return 0;
}
0