結果

問題 No.488 四角関係
ユーザー zaichuzaichu
提出日時 2017-03-08 04:24:43
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 3 ms / 5,000 ms
コード長 1,383 bytes
コンパイル時間 865 ms
コンパイル使用メモリ 101,620 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-06 01:48:40
合計ジャッジ時間 1,901 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 2 ms
4,380 KB
testcase_07 AC 3 ms
4,376 KB
testcase_08 AC 2 ms
4,376 KB
testcase_09 AC 1 ms
4,376 KB
testcase_10 AC 2 ms
4,376 KB
testcase_11 AC 2 ms
4,380 KB
testcase_12 AC 2 ms
4,376 KB
testcase_13 AC 1 ms
4,380 KB
testcase_14 AC 2 ms
4,376 KB
testcase_15 AC 1 ms
4,376 KB
testcase_16 AC 2 ms
4,380 KB
testcase_17 AC 1 ms
4,376 KB
testcase_18 AC 2 ms
4,380 KB
testcase_19 AC 1 ms
4,376 KB
testcase_20 AC 2 ms
4,376 KB
testcase_21 AC 2 ms
4,376 KB
testcase_22 AC 1 ms
4,376 KB
testcase_23 AC 2 ms
4,380 KB
testcase_24 AC 1 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<ctime>
#include<cctype>
#include<climits>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<memory>
#include<functional>

using namespace std;

long pow_mod(long x, long y, long mod) {
  long tmp = 1;
  x %= mod;
  if (y > 0) {
    tmp = pow_mod(x, y / 2, mod);
    if (y % 2) {
      tmp = (((tmp * tmp) % mod) * x) % mod;
    } else {
      tmp = (tmp * tmp) % mod;
    }
  }
  return tmp;
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  int n, m;
  cin >> n >> m;
  
  int a, b;
  vector<vector<int>> ab(n,vector<int>(n));
  for (int i = 0; i < m; i++) {
    cin >> a >> b;
    ab[a][b] = ab[b][a] = 1;
  }

  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++) {

          int x = ab[i][j] + ab[i][k] + ab[i][l];
          int xx = ab[j][i] + ab[j][k] + ab[j][l];
          int xxx = ab[k][i] + ab[k][j] + ab[k][l];
          int xxxx = ab[l][i] + ab[l][j] + ab[l][k];
          if (x == 2 && xx == 2 && xxx == 2 && xxxx == 2) {
            ans++;
          }
        }
      }
    }
  }
  cout << ans << endl;
  return 0;
}
0