結果
問題 |
No.2910 単体ホモロジー入門
|
ユーザー |
|
提出日時 | 2024-10-04 21:56:18 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 775 bytes |
コンパイル時間 | 1,986 ms |
コンパイル使用メモリ | 195,680 KB |
最終ジャッジ日時 | 2025-02-24 15:15:25 |
ジャッジサーバーID (参考情報) |
judge2 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 24 WA * 23 |
ソースコード
#include <bits/stdc++.h> using namespace std; int main () { int N, M; cin >> N >> M; int OK[5][5]; for (auto& a : OK) { for (auto& b : a) { b = 0; } } while(M--) { int a, b; cin >> a >> b; OK[a][b] = OK[b][a] = 1; } int ng = 0; for (int i = 0; i < 3; i ++) { int a; cin >> a; ng |= (1 << a); } for (int s = 1; s < (1 << N); s ++) { if (s == ng) continue; std::vector<int> A; for (int i = 0; i < N; i ++) { if ((s >> i) & 1) { A.push_back(i); } } if (A.size() == 1) continue; bool ok = false; do { bool x = true; for (int i = 1; i < A.size(); i ++) { x = x && OK[A[i-1]][A[i]]; } ok = ok || x; } while (next_permutation(A.begin(), A.end())); if (ok) { puts("Yes"); return 0; } } puts("No"); }