結果

問題 No.488 四角関係
ユーザー 👑 rin204rin204
提出日時 2022-01-20 01:26:11
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 74 ms / 5,000 ms
コード長 506 bytes
コンパイル時間 168 ms
コンパイル使用メモリ 82,176 KB
実行使用メモリ 67,840 KB
最終ジャッジ日時 2024-05-02 20:05:03
合計ジャッジ時間 2,107 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 42 ms
53,632 KB
testcase_01 AC 52 ms
62,720 KB
testcase_02 AC 52 ms
62,976 KB
testcase_03 AC 46 ms
61,056 KB
testcase_04 AC 51 ms
62,464 KB
testcase_05 AC 57 ms
64,896 KB
testcase_06 AC 50 ms
61,056 KB
testcase_07 AC 65 ms
66,176 KB
testcase_08 AC 74 ms
67,840 KB
testcase_09 AC 37 ms
51,968 KB
testcase_10 AC 40 ms
53,248 KB
testcase_11 AC 37 ms
52,480 KB
testcase_12 AC 45 ms
60,928 KB
testcase_13 AC 38 ms
52,864 KB
testcase_14 AC 36 ms
52,224 KB
testcase_15 AC 36 ms
52,224 KB
testcase_16 AC 35 ms
52,096 KB
testcase_17 AC 36 ms
51,840 KB
testcase_18 AC 36 ms
52,224 KB
testcase_19 AC 35 ms
51,840 KB
testcase_20 AC 37 ms
51,968 KB
testcase_21 AC 40 ms
51,968 KB
testcase_22 AC 36 ms
51,840 KB
testcase_23 AC 38 ms
51,968 KB
testcase_24 AC 38 ms
51,840 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