結果

問題 No.488 四角関係
ユーザー 1119_29161119_2916
提出日時 2017-02-24 23:05:43
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 28 ms / 5,000 ms
コード長 1,599 bytes
コンパイル時間 1,410 ms
コンパイル使用メモリ 149,284 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-08-30 23:43:11
合計ジャッジ時間 2,502 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ(β)

テストケース

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

ソースコード

diff #

#include <bits/stdc++.h>
 
using namespace std;
 
#define INF 1001000100010001000
#define MOD 1000000007
#define EPS 1e-10
#define int long long
#define rep(i, N) for (int i = 0; i < N; i++)
#define Rep(i, N) for (int i = 1; i < N; i++)
#define For(i, a, b) for (int i = (a); i < (b); i++)
#define pb push_back
#define mp make_pair
#define i_i pair<int, int>
#define vi vector<int>
#define vvi vector<vi >
#define vb vector<bool>
#define vvb vector<vb >
#define vp vector< i_i >
#define all(a) (a).begin(), (a).end()
#define Int(x) int x; scanf("%lld", &x);
#define int2(x, y) int x, y; scanf("%lld %lld", &x, &y);
 
//int dxy[5] = {0, 1, 0, -1, 0};
// assign
 
vvb graph(50, vb(50, false));
int st, n;

int solve(int pos, int d);

   
signed main()
{
    int m;
    cin >> n >> m;
    rep(i, m) {
        int2(a, b);
        graph[a][b] = true;
        graph[b][a] = true;
    }
    int ans = 0;

    rep(i, n) {
        for (int j = 0; j < n; j++) {
            if (i == j) { continue; }
            for (int k = 0; k < n; k++) {
                if (i == k || j == k) { continue; }
                for (int l = 0; l < n; l++) {
                    if (i == l || j == l || k == l) { continue; }
                    if (graph[i][j] && graph[j][k] && graph[k][l] && 
                            graph[l][i] && !graph[i][k] && !graph[j][l]) {
                        ans++;
                        //cout << i << j << k << l << endl;
                    }
                }
            }
        }
    }
    //cout << (ans/8) + ((ans % 8) ? 1 : 0) << endl;
    cout << ans/8 << endl;
    return 0;
}

0