結果

問題 No.1147 土偶Ⅱ
ユーザー furafura
提出日時 2020-08-06 04:13:48
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 3 ms / 500 ms
コード長 519 bytes
コンパイル時間 1,905 ms
コンパイル使用メモリ 194,916 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-19 18:04:44
合計ジャッジ時間 2,594 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <bits/stdc++.h>

#define rep(i,n) for(int i=0;i<(n);i++)

using namespace std;

int main(){
	int n,m; scanf("%d%d",&n,&m);
	bool A[100][100]={};
	rep(i,m){
		int u,v; scanf("%d%d",&u,&v); u--; v--;
		A[u][v]=A[v][u]=true;
	}

	bool B[100][100]={};
	rep(u,n) rep(v,n) {
		B[u][v]=true;
		rep(w,n) if(A[u][w] && A[w][v]) B[u][v]=false;
		if(A[u][v]) B[u][v]=true;
	}

	int ans=0;
	rep(u,n) for(int v=u+1;v<n;v++) for(int w=v+1;w<n;w++) if(B[u][v] && B[u][w] && B[v][w]) ans++;
	printf("%d\n",ans);

	return 0;
}
0