結果
問題 |
No.488 四角関係
|
ユーザー |
![]() |
提出日時 | 2017-03-02 23:17:19 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 103 ms / 5,000 ms |
コード長 | 1,472 bytes |
コンパイル時間 | 796 ms |
コンパイル使用メモリ | 80,628 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-06-13 01:54:33 |
合計ジャッジ時間 | 2,155 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 22 |
ソースコード
#include <stdlib.h> #include <iostream> #include <vector> #include <string> #include <math.h> #include <algorithm> #define MAX(a,b) ((a)>(b) ? (a) : (b)) #define MIN(a,b) ((a)<(b) ? (a) : (b)) #define ABS(a) ((a)>0 ? (a) : (a * -1)) using namespace std; struct Node{ vector<int>p; }; int main(){ int n, m, x, y, buf1, buf2, buf3, buf4, ans; cin >> n >> m; vector<Node> nd(n); ans = 0; for (int i = 0; i < m; i++) { cin >> x >> y; nd[x].p.push_back(y); nd[y].p.push_back(x); } for (int h = 0; h < n; h++) { for (int j = h + 1; j < n; j++) { for (int k = j + 1; k < n; k++) { for (int l = k + 1; l < n; l++) { buf1 = buf2 = buf3 = buf4 = 0; buf1 += count(nd[h].p.begin(), nd[h].p.end(), j); buf1 += count(nd[h].p.begin(), nd[h].p.end(), k); buf1 += count(nd[h].p.begin(), nd[h].p.end(), l); buf2 += count(nd[j].p.begin(), nd[j].p.end(), h); buf2 += count(nd[j].p.begin(), nd[j].p.end(), k); buf2 += count(nd[j].p.begin(), nd[j].p.end(), l); buf3 += count(nd[k].p.begin(), nd[k].p.end(), h); buf3 += count(nd[k].p.begin(), nd[k].p.end(), j); buf3 += count(nd[k].p.begin(), nd[k].p.end(), l); buf4 += count(nd[l].p.begin(), nd[l].p.end(), h); buf4 += count(nd[l].p.begin(), nd[l].p.end(), j); buf4 += count(nd[l].p.begin(), nd[l].p.end(), k); if (buf1 == 2 && buf2 == 2 && buf3 == 2 && buf3 == 2 && buf4 == 2) { ans ++; } } } } } cout << ans << endl; }