結果
| 問題 |
No.2910 単体ホモロジー入門
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-10-04 22:04:09 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 820 bytes |
| コンパイル時間 | 2,366 ms |
| コンパイル使用メモリ | 195,528 KB |
| 最終ジャッジ日時 | 2025-02-24 15:18:37 |
|
ジャッジサーバーID (参考情報) |
judge4 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 20 WA * 23 RE * 4 |
ソースコード
#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]];
}
x = x && OK[A[0]][A.back()];
ok = ok || x;
} while (next_permutation(A.begin(), A.end()));
if (ok) {
puts("Yes");
return 0;
}
}
puts("No");
return 139;
}