結果

問題 No.1147 土偶Ⅱ
ユーザー rlangevinrlangevin
提出日時 2023-01-15 14:08:30
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 627 bytes
コンパイル時間 526 ms
コンパイル使用メモリ 86,848 KB
実行使用メモリ 109,652 KB
最終ジャッジ日時 2023-08-27 21:42:23
合計ジャッジ時間 8,525 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 83 ms
74,920 KB
testcase_01 AC 79 ms
71,276 KB
testcase_02 AC 76 ms
71,296 KB
testcase_03 AC 76 ms
71,336 KB
testcase_04 AC 192 ms
79,368 KB
testcase_05 AC 79 ms
71,512 KB
testcase_06 AC 452 ms
82,632 KB
testcase_07 TLE -
testcase_08 AC 105 ms
77,608 KB
testcase_09 AC 345 ms
81,448 KB
testcase_10 AC 185 ms
78,832 KB
testcase_11 AC 492 ms
109,652 KB
testcase_12 AC 227 ms
84,948 KB
testcase_13 AC 111 ms
78,328 KB
testcase_14 AC 215 ms
95,484 KB
testcase_15 AC 432 ms
84,272 KB
testcase_16 AC 142 ms
78,936 KB
testcase_17 AC 86 ms
76,512 KB
testcase_18 AC 94 ms
76,688 KB
testcase_19 TLE -
testcase_20 AC 85 ms
76,368 KB
testcase_21 AC 77 ms
71,348 KB
testcase_22 AC 311 ms
80,728 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N, M = map(int, input().split())
S = set()
G = [[] for i in range(N)]
for i in range(M):
    a, b = map(int, input().split())
    a, b = a - 1, b - 1
    if (a, b) in S:
        continue
    S.add((a, b))
    S.add((b, a))
    G[a].append(b)
    G[b].append(a)
    
SS = set()
for i in range(N):
    M = len(G[i])
    for x in range(M):
        for y in range(x + 1, M):
            a, b = G[i][x], G[i][y]
            if (a, b) not in S:
                for k in range(N):
                    if k != a and  k != b:
                        SS.add(tuple(sorted([k, a, b])))
print(N * (N - 1) * (N - 2)//6 - len(SS))            
0