結果

問題 No.1227 I hate ThREE
ユーザー tyawanmusi
提出日時 2020-07-27 19:25:44
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 313 bytes
コンパイル時間 451 ms
コンパイル使用メモリ 82,040 KB
実行使用メモリ 146,432 KB
最終ジャッジ日時 2024-11-15 15:47:14
合計ジャッジ時間 98,137 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 1 TLE * 32
権限があれば一括ダウンロードができます

ソースコード

diff #

n,c=map(int,input().split())
edge=[]
for _ in range(n-1):
  a,b=map(int,input().split())
  a-=1
  b-=1
  edge.append((a,b))
ans=0
for i in range(c**n):
  color=[]
  for j in range(n):
    color.append(i%c)
    i//=c
  flag=True
  for a,b in edge:
    if abs(color[a]-color[b])!=3:flag=False
  ans+=flag
print(ans)
0