結果

問題 No.488 四角関係
ユーザー suibaka_kusuibaka_ku
提出日時 2017-03-19 16:15:20
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 33 ms / 5,000 ms
コード長 960 bytes
コンパイル時間 901 ms
コンパイル使用メモリ 89,332 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-18 07:30:02
合計ジャッジ時間 2,592 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 12 ms
4,376 KB
testcase_01 AC 11 ms
4,376 KB
testcase_02 AC 12 ms
4,376 KB
testcase_03 AC 6 ms
4,376 KB
testcase_04 AC 8 ms
4,380 KB
testcase_05 AC 16 ms
4,376 KB
testcase_06 AC 21 ms
4,380 KB
testcase_07 AC 33 ms
4,376 KB
testcase_08 AC 32 ms
4,380 KB
testcase_09 AC 2 ms
4,376 KB
testcase_10 AC 4 ms
4,376 KB
testcase_11 AC 1 ms
4,380 KB
testcase_12 AC 3 ms
4,376 KB
testcase_13 AC 4 ms
4,376 KB
testcase_14 AC 2 ms
4,380 KB
testcase_15 AC 1 ms
4,380 KB
testcase_16 AC 2 ms
4,376 KB
testcase_17 AC 2 ms
4,376 KB
testcase_18 AC 2 ms
4,376 KB
testcase_19 AC 1 ms
4,376 KB
testcase_20 AC 2 ms
4,376 KB
testcase_21 AC 1 ms
4,376 KB
testcase_22 AC 1 ms
4,376 KB
testcase_23 AC 1 ms
4,376 KB
testcase_24 AC 1 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <set>
#include <map>
#include <cmath>
#include <iomanip>
#include <codecvt>
#include <locale>
using namespace std;
using ll = long long;

int main() {
    int N, M;
    cin >> N >> M;
    vector<vector<int>> g(N, vector<int>(N));
    for(int i=0; i<M; ++i) {
        int a, b;
        cin >> a >> b;
        g[a][b] = g[b][a] = 1;
    }
    int res = 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) {
                    if(i == j || i == k || i == l || j == k || j == l || k == l) {
                        continue;
                    }
                    if(g[i][j] && g[j][k] && g[k][l] && g[l][i] && g[i][k] != 1 && g[j][l] != 1) {
                        res++;
                    }
                }
            }
        }
    }
    res /= 8;
    cout << res << endl;
}
0