結果
問題 | No.488 四角関係 |
ユーザー |
![]() |
提出日時 | 2017-02-24 22:39:32 |
言語 | C++11 (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 29 ms / 5,000 ms |
コード長 | 1,251 bytes |
コンパイル時間 | 993 ms |
コンパイル使用メモリ | 90,352 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2025-01-02 23:10:51 |
合計ジャッジ時間 | 1,946 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 22 |
ソースコード
#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;}