結果
問題 | No.488 四角関係 |
ユーザー |
|
提出日時 | 2017-04-02 04:15:08 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 31 ms / 5,000 ms |
コード長 | 1,281 bytes |
コンパイル時間 | 1,073 ms |
コンパイル使用メモリ | 106,420 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-07-07 20:10:20 |
合計ジャッジ時間 | 2,246 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 22 |
ソースコード
#define _USE_MATH_DEFINES#include <cstdio>#include <iostream>#include <sstream>#include <fstream>#include <iomanip>#include <algorithm>#include <cmath>#include <complex>#include <string>#include <vector>#include <list>#include <queue>#include <stack>#include <set>#include <map>#include <bitset>#include <numeric>#include <limits>#include <climits>#include <cfloat>#include <functional>#include <iterator>using namespace std;int main(){int n, m;cin >> n >> m;vector<vector<bool> > graph(n, vector<bool>(n, false));for(int i=0; i<m; ++i){int a, b;cin >> a >> b;graph[a][b] = graph[b][a] = true;}int ans = 0;for(int a=0; a<n; ++a){for(int b=0; b<n; ++b){if(b == a || !graph[a][b])continue;for(int c=0; c<n; ++c){if(c == a || c == b || !graph[b][c])continue;for(int d=0; d<n; ++d){if(d == a || d == b || d == c || !graph[c][d] || !graph[d][a])continue;if(!graph[a][c] && !graph[b][d])++ ans;}}}}ans /= 8;cout << ans << endl;return 0;}