結果
| 問題 | No.2910 単体ホモロジー入門 |
| コンテスト | |
| ユーザー |
eve__fuyuki
|
| 提出日時 | 2024-10-07 01:39:00 |
| 言語 | C++17 (gcc 15.3.0 + boost 1.92.0 + ACL) |
| 結果 |
AC
不安定
|
| 実行時間 | 1 ms / 2,000 ms |
| + 769µs | |
| コード長 | 1,057 bytes |
| 記録 | |
| コンパイル時間 | 1,300 ms |
| コンパイル使用メモリ | 220,712 KB |
| 実行使用メモリ | 9,904 KB |
| 最終ジャッジ日時 | 2026-10-23 12:07:42 |
| 合計ジャッジ時間 | 3,725 ms |
|
ジャッジサーバーID (参考情報) |
judge4_0 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 48 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
void fast_io() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
}
int main() {
fast_io();
int n, m;
cin >> n >> m;
bool g[n][n] = {};
for (int i = 0; i < m; i++) {
int a, b;
cin >> a >> b;
g[a][b] = g[b][a] = true;
}
set<int> v;
for (int i = 0; i < 3; i++) {
int a;
cin >> a;
v.insert(a);
}
int p[n];
iota(p, p + n, 0);
do {
bool ok = true;
for (int i = 0; i < n; i++) {
if (!g[p[i]][p[(i + 1) % n]]) {
ok = false;
break;
}
}
if (ok) {
set<int> st;
for (int i = 0; i < 3; i++) {
st.insert(p[i]);
}
if (st != v) {
cout << "Yes" << endl;
return 0;
}
}
if (n == 4) {
bool ok = true;
for (int i = 0; i < 3; i++) {
if (!g[p[i]][p[(i + 1) % 3]]) {
ok = false;
break;
}
}
if (ok) {
set<int> st;
for (int i = 0; i < 3; i++) {
st.insert(p[i]);
}
if (st != v) {
cout << "Yes" << endl;
return 0;
}
}
}
} while (next_permutation(p, p + n));
cout << "No" << endl;
}
eve__fuyuki