結果

問題 No.488 四角関係
ユーザー kotamanegikotamanegi
提出日時 2017-02-24 22:39:32
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 25 ms / 5,000 ms
コード長 1,251 bytes
コンパイル時間 671 ms
コンパイル使用メモリ 86,952 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-08-30 23:30:31
合計ジャッジ時間 1,837 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 12 ms
4,376 KB
testcase_01 AC 8 ms
4,380 KB
testcase_02 AC 12 ms
4,380 KB
testcase_03 AC 5 ms
4,380 KB
testcase_04 AC 7 ms
4,376 KB
testcase_05 AC 14 ms
4,376 KB
testcase_06 AC 23 ms
4,376 KB
testcase_07 AC 25 ms
4,376 KB
testcase_08 AC 23 ms
4,376 KB
testcase_09 AC 1 ms
4,376 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 3 ms
4,376 KB
testcase_14 AC 2 ms
4,376 KB
testcase_15 AC 2 ms
4,376 KB
testcase_16 AC 2 ms
4,376 KB
testcase_17 AC 1 ms
4,380 KB
testcase_18 AC 1 ms
4,376 KB
testcase_19 AC 1 ms
4,380 KB
testcase_20 AC 1 ms
4,380 KB
testcase_21 AC 1 ms
4,376 KB
testcase_22 AC 2 ms
4,376 KB
testcase_23 AC 2 ms
4,376 KB
testcase_24 AC 2 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#define  _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <math.h>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <math.h>
#include <iostream> 
#include<map>
#include <iomanip>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
using namespace std;
#define MAX_MOD 1000000007
#define REP(i,n) for(long long i = 0;i < n;++i)
int graph[100][100] = {};
int main() {
	int n, m;
	cin >> n >> m;
	for (int i = 0;i < m;++i) {
		int a, b;
		cin >> a >> b;
		graph[a][b] = true;
		graph[b][a] = true;
	}
	long long ans = 0;
	for (int i = 0;i < n;++i) {
		for (int q = i + 1;q < n;++q) {
			for (int j = q + 1;j < n;++j) {
				for (int t = j + 1;t < n;++t) {
					vector<int> wow;
					wow.push_back(i);
					wow.push_back(q);
					wow.push_back(j);
					wow.push_back(t);
					for (int wa = 0;wa < 4;++wa) {
						int cnt = 0;
						for (int ta = 0;ta < 4;++ta) {
							if (ta != wa) {
								if (graph[wow[wa]][wow[ta]] == true) cnt++;
							}
						}
						if (cnt != 2) goto failed;
					}
					ans++;
				failed:;
				}
			}
		}
	}
	cout << ans << endl;
	return 0;
}
0