結果
| 問題 | No.3275 Minesweeper on Graph | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2025-09-19 21:28:10 | 
| 言語 | PyPy3 (7.3.15) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 117 ms / 2,000 ms | 
| コード長 | 395 bytes | 
| コンパイル時間 | 340 ms | 
| コンパイル使用メモリ | 82,100 KB | 
| 実行使用メモリ | 76,408 KB | 
| 最終ジャッジ日時 | 2025-09-19 21:28:22 | 
| 合計ジャッジ時間 | 6,676 ms | 
| ジャッジサーバーID (参考情報) | judge4 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 40 | 
ソースコード
n,m=map(int,input().split())
a=list(map(int,input().split()))
b=[[]for _ in range(n)]
for i in range(m):
	s,t=map(int,input().split())
	b[s-1].append(t-1)
	b[t-1].append(s-1)
for i in range(2**n):
	c=[0 for _ in range(n)]
	ans=[]
	for j in range(n):
		if i>>j&1:
			ans.append(1)
			for k in b[j]:
				c[k]+=1 
		else:
			ans.append(0)
	if a==c:
		print('Yes')
		print(*ans)
		exit()
print('No')
            
            
            
        