結果
問題 |
No.3275 Minesweeper on Graph
|
ユーザー |
|
提出日時 | 2025-09-20 00:56:17 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 853 bytes |
コンパイル時間 | 1,766 ms |
コンパイル使用メモリ | 201,060 KB |
実行使用メモリ | 7,716 KB |
最終ジャッジ日時 | 2025-09-20 00:56:23 |
合計ジャッジ時間 | 5,644 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 30 WA * 10 |
ソースコード
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); int N,M; cin >> N >> M; vector<int> A(N); for(auto &a : A) cin >> a; vector<vector<int>> Graph(N); for(int i=0; i<M; i++){ int u,v; cin >> u >> v; u--; v--; Graph.at(u).push_back(v); Graph.at(v).push_back(u); } vector<int> X(N),C(N); auto dfs = [&](auto dfs,int pos) -> void { if(A == C){ cout << "Yes\n"; for(auto x : X) cout << x << " "; cout << endl; exit(0); } if(pos == N) return; X.at(pos) = 0,dfs(dfs,pos+1); for(auto to : Graph.at(pos)) C.at(to)++; X.at(pos) = 1,dfs(dfs,pos+1); for(auto to : Graph.at(pos)) C.at(to)--; }; dfs(dfs,0); cout << "No\n"; }