結果
問題 |
No.3275 Minesweeper on Graph
|
ユーザー |
|
提出日時 | 2025-09-19 21:28:37 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 4 ms / 2,000 ms |
コード長 | 814 bytes |
コンパイル時間 | 1,893 ms |
コンパイル使用メモリ | 195,764 KB |
実行使用メモリ | 7,720 KB |
最終ジャッジ日時 | 2025-09-19 21:28:46 |
合計ジャッジ時間 | 5,079 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 40 |
ソースコード
#include <bits/stdc++.h> using namespace std; using ll = long long; int main() { ios::sync_with_stdio(false); cin.tie(0); int n, m, u, v; cin >> n >> m; vector<int> A(n), S(n); for(auto &&v : A) cin >> v; for(int i = 0; i < m; i++){ cin >> u >> v; u--, v--; S[u] |= 1 << v; S[v] |= 1 << u; } for(int U = 0; U < (1 << n); U++){ bool flg = true; for(int j = 0; j < n; j++){ if(__builtin_popcount(S[j] & U) != A[j]){ flg = false; break; } } if(flg){ cout << "Yes\n"; for(int j = 0; j < n; j++){ cout << (U >> j & 1) << (j + 1 == n ? '\n' : ' '); } return 0; } } cout << "No\n"; }