結果

問題 No.488 四角関係
ユーザー 👑 rin204rin204
提出日時 2022-01-20 01:26:11
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 93 ms / 5,000 ms
コード長 506 bytes
コンパイル時間 423 ms
コンパイル使用メモリ 86,768 KB
実行使用メモリ 76,688 KB
最終ジャッジ日時 2023-08-15 08:17:16
合計ジャッジ時間 4,450 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 76 ms
71,220 KB
testcase_01 AC 84 ms
76,112 KB
testcase_02 AC 85 ms
76,348 KB
testcase_03 AC 80 ms
76,140 KB
testcase_04 AC 85 ms
76,164 KB
testcase_05 AC 88 ms
76,320 KB
testcase_06 AC 80 ms
76,236 KB
testcase_07 AC 91 ms
76,268 KB
testcase_08 AC 93 ms
76,688 KB
testcase_09 AC 70 ms
71,284 KB
testcase_10 AC 75 ms
71,316 KB
testcase_11 AC 72 ms
71,200 KB
testcase_12 AC 81 ms
76,156 KB
testcase_13 AC 74 ms
71,352 KB
testcase_14 AC 74 ms
71,220 KB
testcase_15 AC 71 ms
71,072 KB
testcase_16 AC 71 ms
71,360 KB
testcase_17 AC 71 ms
71,328 KB
testcase_18 AC 72 ms
71,340 KB
testcase_19 AC 73 ms
71,280 KB
testcase_20 AC 72 ms
70,928 KB
testcase_21 AC 71 ms
71,440 KB
testcase_22 AC 71 ms
71,316 KB
testcase_23 AC 73 ms
71,180 KB
testcase_24 AC 72 ms
71,280 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n, m = map(int, input().split())
edges = [set() for _ in range(n)]
for _ in range(m):
    a, b = map(int, input().split())
    edges[a].add(b)
    edges[b].add(a)
    
ans = 0
for i in range(n):
    for j in range(i + 1, n):
        if j in edges[i]:
            continue
        se = edges[i] & edges[j]
        lst = list(se)
        l = len(lst)
        for k in range(l):
            for o in range(k + 1, l):
                if lst[o] not in edges[lst[k]]:
                    ans += 1
print(ans // 2)
0