結果

問題 No.488 四角関係
ユーザー Mr.FukuMr.Fuku
提出日時 2018-08-07 22:17:50
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 83 ms / 5,000 ms
コード長 440 bytes
コンパイル時間 78 ms
コンパイル使用メモリ 11,860 KB
実行使用メモリ 10,180 KB
最終ジャッジ日時 2023-10-19 22:30:37
合計ジャッジ時間 1,887 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 32 ms
10,140 KB
testcase_01 AC 44 ms
10,148 KB
testcase_02 AC 37 ms
10,148 KB
testcase_03 AC 35 ms
10,144 KB
testcase_04 AC 37 ms
10,144 KB
testcase_05 AC 47 ms
10,152 KB
testcase_06 AC 32 ms
10,140 KB
testcase_07 AC 75 ms
10,152 KB
testcase_08 AC 83 ms
10,180 KB
testcase_09 AC 31 ms
10,136 KB
testcase_10 AC 37 ms
10,140 KB
testcase_11 AC 30 ms
10,136 KB
testcase_12 AC 34 ms
10,140 KB
testcase_13 AC 33 ms
10,140 KB
testcase_14 AC 31 ms
10,136 KB
testcase_15 AC 30 ms
10,136 KB
testcase_16 AC 30 ms
10,136 KB
testcase_17 AC 30 ms
10,136 KB
testcase_18 AC 30 ms
10,136 KB
testcase_19 AC 30 ms
10,136 KB
testcase_20 AC 29 ms
10,136 KB
testcase_21 AC 30 ms
10,136 KB
testcase_22 AC 30 ms
10,136 KB
testcase_23 AC 30 ms
10,136 KB
testcase_24 AC 30 ms
10,136 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N,M = map(int,input().split())
n_list = [[] for _ in range(N)]

for i in range(M):
    nd1,nd2 = map(int,input().split())
    n_list[nd1].append(nd2)
    n_list[nd2].append(nd1)

cnt = 0
for i,nod in enumerate(n_list):
    len_n = len(nod)
    if len_n<2:
        continue
    for j in nod:
        for k in nod:
            if j<k and k not in n_list[j]:
                cnt += len(set(n_list[j])&set(n_list[k])-set(nod+[i]))
print(cnt//4)
0