結果
問題 | No.488 四角関係 |
ユーザー |
|
提出日時 | 2018-06-29 03:39:05 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 133 ms / 5,000 ms |
コード長 | 687 bytes |
コンパイル時間 | 88 ms |
コンパイル使用メモリ | 12,672 KB |
実行使用メモリ | 11,008 KB |
最終ジャッジ日時 | 2024-06-30 23:43:10 |
合計ジャッジ時間 | 2,261 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 22 |
ソースコード
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] * N for _ in [0] * N] 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()