結果

問題 No.488 四角関係
ユーザー beetbeet
提出日時 2017-02-24 22:35:19
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 3 ms / 5,000 ms
コード長 901 bytes
コンパイル時間 1,138 ms
コンパイル使用メモリ 145,608 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-08-30 23:28:05
合計ジャッジ時間 2,175 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ(β)

テストケース

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

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
#define int long long
signed main(){
  int n,m;
  cin>>n>>m;
  int e[n][n];
  memset(e,0,sizeof(e));
  for(int i=0;i<m;i++){
    int a,b;
    cin>>a>>b;
    e[a][b]=e[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 tmp=0,d[4];
	  if(e[i][j]) d[tmp++]=j;
	  if(e[i][k]) d[tmp++]=k;
	  if(e[i][l]) d[tmp++]=l;
	  if(tmp!=2) continue;
	  tmp=0;
	  if(e[j][i]) d[tmp++]=i;
	  if(e[j][k]) d[tmp++]=k;
	  if(e[j][l]) d[tmp++]=l;
	  if(tmp!=2) continue;
	  tmp=0;
	  if(e[k][i]) d[tmp++]=i;
	  if(e[k][j]) d[tmp++]=j;
	  if(e[k][l]) d[tmp++]=l;
	  if(tmp!=2) continue;
	  tmp=0;
	  if(e[l][i]) d[tmp++]=i;
	  if(e[l][j]) d[tmp++]=j;
	  if(e[l][k]) d[tmp++]=k;
	  if(tmp!=2) continue;
	  
	  if(!e[d[0]][d[1]]) ans++;
	}
      }
    }
  }
  cout<<ans<<endl;
  return 0;
}
0