結果

問題 No.488 四角関係
ユーザー moririn2528_cmoririn2528_c
提出日時 2017-02-24 22:52:03
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 25 ms / 5,000 ms
コード長 622 bytes
コンパイル時間 396 ms
コンパイル使用メモリ 52,696 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-08-30 23:36:51
合計ジャッジ時間 1,539 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ(β)

テストケース

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

ソースコード

diff #

#include<iostream>
using namespace std;
int path[55][55];

int check(int a,int b,int c,int d){
	if(a==b)return 1;
	if(a==c)return 1;
	if(a==d)return 1;
	if(b==c)return 1;
	if(b==d)return 1;
	if(c==d)return 1;
	return 0;
}

int main(){
	int n,m;
	int i,j,k,l;
	int a,b,c,s=0;
	cin>>n>>m;
	for(i=0;i<m;i++){
		cin>>a>>b;
		path[a][b]=1;
		path[b][a]=1;
	}
	for(i=0;i<n;i++){
		for(j=0;j<n;j++){
			for(k=0;k<n;k++){
				for(l=0;l<n;l++){
					if(check(i,j,k,l)==1)continue;
					a=path[i][j]+path[j][k]+path[k][l]+path[l][i];
					a-=path[i][k]+path[j][l];
					if(a==4)s++;
				}
			}
		}
	}
	cout<<s/8<<endl;
	return 0;
}
0