結果

問題 No.488 四角関係
ユーザー karinohito
提出日時 2024-10-07 23:41:05
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 17 ms / 5,000 ms
コード長 669 bytes
コンパイル時間 1,931 ms
コンパイル使用メモリ 198,600 KB
最終ジャッジ日時 2025-02-24 16:41:38
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 22
権限があれば一括ダウンロードができます

ソースコード

diff #

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

int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    int N,M;
    cin>>N>>M;
    vector<vector<int>> A(N,vector<int>(N,0));
    for(int i=0;i<M;i++){
        int a,b;
        cin>>a>>b;
        A[a][b]=A[b][a]=1;
    }
    int an=0;
    for(int a=0;a<N;a++){
        for(int b=0;b<N;b++){
            for(int c=0;c<N;c++){
                for(int d=0;d<N;d++){
                    if(A[a][b]+A[b][c]+A[c][d]+A[d][a]==4&&A[a][c]+A[b][d]==0&&(a-c)*(b-d)!=0){
                        an++;
                    }
                }
            }
        }
    }
    cout<<an/8<<endl;

}
0