結果
問題 | No.488 四角関係 |
ユーザー |
|
提出日時 | 2017-02-25 14:17:01 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 10 ms / 5,000 ms |
コード長 | 808 bytes |
コンパイル時間 | 778 ms |
コンパイル使用メモリ | 77,420 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-06-11 14:58:11 |
合計ジャッジ時間 | 1,656 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 22 |
ソースコード
#include <iostream>#include <cstdio>#include <vector>#include <algorithm>#include <utility>#include <string>using namespace std;vector<vector<bool>> connect;bool isquad(int a, int b, int c, int d) {if (connect[a][b] && connect[b][c] && connect[c][d] && connect[d][a] &&!connect[a][c] && !connect[b][d]) {return true;}return false;}int main() {int n, m;cin >> n >> m;connect.assign(n, vector<bool>(n, false));int a, b;for (int i = 0; i < m; i++) {cin >> a >> b;connect[a][b] = true;connect[b][a] = true;}int ans = 0;for (int i = 0; i < n; i++)for (int j = i+1; j < n; j++)for (int k = j+1; k < n; k++)for (int l = k+1; l < n; l++) {ans += isquad(i,j,k,l);ans += isquad(i,j,l,k);ans += isquad(i,k,j,l);}cout << ans << endl;return 0;}