結果
問題 | No.488 四角関係 |
ユーザー |
![]() |
提出日時 | 2017-03-20 23:59:35 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 1,062 ms / 5,000 ms |
コード長 | 468 bytes |
コンパイル時間 | 74 ms |
コンパイル使用メモリ | 12,672 KB |
実行使用メモリ | 10,880 KB |
最終ジャッジ日時 | 2024-07-05 04:35:34 |
合計ジャッジ時間 | 7,591 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 22 |
ソースコード
import itertoolsif __name__ == '__main__':n, m = map(int, input().split())matrix = [[0 for _ in range(n)] for _ in range(n)]for _ in range(m):x, y = map(int, input().split())matrix[x][y] = matrix[y][x] = 1cnt = 0for points in itertools.combinations(range(n), 4):totals = [sum(matrix[start][other] for other in points) for start in points]if all(total == 2 for total in totals): cnt += 1print(cnt)