結果

問題 No.1147 土偶Ⅱ
ユーザー rythem00359rythem00359
提出日時 2020-08-18 11:35:55
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 574 bytes
コンパイル時間 109 ms
コンパイル使用メモリ 12,800 KB
実行使用メモリ 11,520 KB
最終ジャッジ日時 2024-04-20 07:27:33
合計ジャッジ時間 4,061 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 33 ms
10,752 KB
testcase_01 AC 31 ms
10,624 KB
testcase_02 AC 31 ms
10,752 KB
testcase_03 AC 30 ms
10,624 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 TLE -
testcase_12 WA -
testcase_13 WA -
testcase_14 TLE -
testcase_15 WA -
testcase_16 WA -
testcase_17 AC 32 ms
10,752 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 31 ms
10,624 KB
testcase_21 AC 29 ms
10,752 KB
testcase_22 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

n,m=map(int,input().split())
g=[[n*2]*n for _ in range(n)]
for _ in range(m):
    a=list(map(int,input().split()))
    g[a[0]-1][a[1]-1]=1
    g[a[1]-1][a[0]-1]=1
for k in range(n):
    for i in range(n):
        for j in range(n):
            g[i][j]=min(g[i][j],g[i][k]+g[k][j])
ans=set()
for i in range(n):
    for j in range(i+1,n):
        if g[i][j]!=2:
            for k in range(j+1,n):
                if g[j][k]!=2 and g[k][i]!=2 and k!=i:
                    a=sorted([i+1,j+1,k+1])
                    ans.add(a[0]*100+a[1]*10+a[2])
ans=list(ans)
print(len(ans))
0