結果

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

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n,m; cin >> n >> m;
    vector<vector<bool>> e(n,vector<bool>(n,false));
    int res=0;
    while(m--){
        int x,y; cin >> x >> y;
        e[x][y]=e[y][x]=true;
    }
    for(int i=0;i<n;i++){
        for(int j=0;j<n;j++){
            if(!e[i][j])continue;
            for(int k=0;k<n;k++){
                if(!e[j][k] or e[i][k])continue;
                if(i==k or j==k)continue;
                for(int l=0;l<n;l++){
                    if(i==l or j==l or k==l)continue;
                    if(e[k][l] and !e[l][j] and e[l][i]){
                        res++;
                    }
                }
            }
        }
    }
    cout << res/8 << endl;
}
0