結果

問題 No.1147 土偶Ⅱ
ユーザー kozykozy
提出日時 2020-08-05 09:32:12
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 259 ms / 500 ms
コード長 555 bytes
コンパイル時間 321 ms
コンパイル使用メモリ 12,928 KB
実行使用メモリ 22,144 KB
最終ジャッジ日時 2024-04-19 18:03:04
合計ジャッジ時間 2,525 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 29 ms
10,752 KB
testcase_01 AC 27 ms
10,752 KB
testcase_02 AC 28 ms
10,752 KB
testcase_03 AC 30 ms
10,880 KB
testcase_04 AC 51 ms
11,904 KB
testcase_05 AC 27 ms
10,880 KB
testcase_06 AC 138 ms
13,568 KB
testcase_07 AC 161 ms
17,664 KB
testcase_08 AC 32 ms
11,136 KB
testcase_09 AC 99 ms
12,928 KB
testcase_10 AC 52 ms
11,776 KB
testcase_11 AC 259 ms
22,144 KB
testcase_12 AC 81 ms
14,208 KB
testcase_13 AC 36 ms
11,520 KB
testcase_14 AC 197 ms
19,456 KB
testcase_15 AC 96 ms
13,952 KB
testcase_16 AC 42 ms
11,776 KB
testcase_17 AC 27 ms
10,880 KB
testcase_18 AC 30 ms
11,008 KB
testcase_19 AC 140 ms
14,464 KB
testcase_20 AC 29 ms
10,880 KB
testcase_21 AC 27 ms
10,752 KB
testcase_22 AC 108 ms
12,672 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import itertools
X=list()
Y=list()
N,M=map(int,input().split())
L=[[] for j in range(N)]
R=[[] for j in range(N)]
for i in range(M):
    x,y=map(int,input().split())
    L[x-1].append(y)
    L[y-1].append(x)
for i in range(N):
    for j in range(len(L[i])):
        R[i].extend(L[L[i][j]-1])
    R[i]=[l for l in R[i] if l not in L[i]]
R=[list(set(i)) for i in R]
ans=0
p_list = list(itertools.combinations(range(1,N+1), 3))
for i in range(len(p_list)):
  a,b,c=p_list[i]
  if b not in R[a-1] and c not in R[a-1] and b not in R[c-1]:
    ans+=1
print(ans)
0