結果

問題 No.488 四角関係
ユーザー GrayCoderGrayCoder
提出日時 2018-06-29 03:37:19
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
RE  
実行時間 -
コード長 687 bytes
コンパイル時間 1,006 ms
コンパイル使用メモリ 10,920 KB
実行使用メモリ 20,164 KB
最終ジャッジ日時 2023-09-13 15:04:09
合計ジャッジ時間 2,337 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 64 ms
8,280 KB
testcase_01 AC 47 ms
9,064 KB
testcase_02 AC 61 ms
8,516 KB
testcase_03 AC 31 ms
8,548 KB
testcase_04 AC 40 ms
8,508 KB
testcase_05 AC 73 ms
9,168 KB
testcase_06 AC 113 ms
8,448 KB
testcase_07 AC 124 ms
11,196 KB
testcase_08 AC 131 ms
20,164 KB
testcase_09 RE -
testcase_10 AC 24 ms
8,396 KB
testcase_11 AC 16 ms
8,284 KB
testcase_12 AC 19 ms
8,356 KB
testcase_13 AC 23 ms
8,284 KB
testcase_14 AC 17 ms
8,188 KB
testcase_15 RE -
testcase_16 AC 15 ms
8,332 KB
testcase_17 AC 15 ms
8,156 KB
testcase_18 AC 16 ms
8,180 KB
testcase_19 AC 16 ms
8,208 KB
testcase_20 AC 15 ms
8,172 KB
testcase_21 RE -
testcase_22 AC 15 ms
8,300 KB
testcase_23 AC 15 ms
8,152 KB
testcase_24 AC 16 ms
8,352 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from itertools import combinations
from sys import stdin, stdout
input = lambda: stdin.readline().rstrip()
write = stdout.write

def main():
    N, M = map(int, input().split())
    AB = [tuple(map(int, input().split())) for _ in [0] * M]

    edge = [[0] * M for _ in [0] * M]
    for a, b in AB:
        edge[a][b] = edge[b][a] = 1

    square = 0
    for a, b, c, d in combinations(range(N), 4):
        if all((edge[a][b] + edge[a][c] + edge[a][d] == 2,
                edge[b][a] + edge[b][c] + edge[b][d] == 2,
                edge[c][a] + edge[c][b] + edge[c][d] == 2,
                edge[d][a] + edge[d][b] + edge[d][c] == 2)):
            square += 1
    print(square)

main()
0