結果

問題 No.3275 Minesweeper on Graph
ユーザー ゼット
提出日時 2025-09-19 21:22:50
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 188 ms / 2,000 ms
コード長 394 bytes
コンパイル時間 391 ms
コンパイル使用メモリ 82,200 KB
実行使用メモリ 76,340 KB
最終ジャッジ日時 2025-09-19 21:22:57
合計ジャッジ時間 6,810 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 40
権限があれば一括ダウンロードができます

ソースコード

diff #

N,M=map(int,input().split())
A=list(map(int,input().split()))
from itertools import product
G=[[] for i in range(N)]
for i in range(M):
  a,b=map(int,input().split())
  G[a-1].append(b-1)
  G[b-1].append(a-1)
for B in product(range(2),repeat=N):
  v=[0]*N
  for i in range(N):
    for j in G[i]:
      v[i]+=B[j]
  if v==A:
    print('Yes')
    C=list(B)
    print(*C)
    exit()
print('No')
  
0