結果
| 問題 | No.3275 Minesweeper on Graph | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2025-09-23 20:07:38 | 
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 19 ms / 2,000 ms | 
| コード長 | 1,285 bytes | 
| コンパイル時間 | 3,005 ms | 
| コンパイル使用メモリ | 281,704 KB | 
| 実行使用メモリ | 7,716 KB | 
| 最終ジャッジ日時 | 2025-09-23 20:07:48 | 
| 合計ジャッジ時間 | 7,362 ms | 
| ジャッジサーバーID (参考情報) | judge2 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 40 | 
ソースコード
#include <bits/stdc++.h>
// #include <atcoder/all>
using namespace std;
// using namespace atcoder;
#define rep(i, a, n) for(int i = a; i < n; i++)
#define rrep(i, a, n) for(int i = a; i >= n; i--)
#define inr(l, x, r) (l <= x && x < r)
#define ll long long
#define ld long double
// using mint = modint1000000007;
// using mint = modint998244353;
constexpr int IINF = 1001001001;
constexpr ll INF = 1e18;
template<class t,class u> void chmax(t&a,u b){if(a<b)a=b;}
template<class t,class u> void chmin(t&a,u b){if(b<a)a=b;}
int main(){
    int n, m; cin >> n >> m;
    vector<int> a(n);
    rep(i, 0, n) cin >> a[i];
    vector<vector<int>> g(n);
    rep(i, 0, m){
        int u, v; cin >> u >> v; u--, v--;
        g[u].push_back(v);
        g[v].push_back(u);
    }
    rep(i, 0, 1<<n){
        bool ok = true;
        rep(j, 0, n){
            int cnt = 0;
            for(auto nj: g[j]){
                if((i>>nj)&1) cnt++;
            }
            if(cnt != a[j]) ok = false;
        }
        if(ok){
            cout << "Yes" << endl;
            rep(j, 0, n){
                if((i>>j)&1) cout << 1 << ' ';
                else cout << 0 << ' ';
            }
            cout << endl;
            return 0;
        }
    }
    cout << "No" << endl;
    
    return 0;
}
            
            
            
        