結果
問題 |
No.2910 単体ホモロジー入門
|
ユーザー |
|
提出日時 | 2024-10-04 21:31:09 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 31 ms / 2,000 ms |
コード長 | 1,213 bytes |
コンパイル時間 | 2,212 ms |
コンパイル使用メモリ | 208,636 KB |
最終ジャッジ日時 | 2025-02-24 15:03:08 |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 47 |
ソースコード
#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<vector<bool>> G(N,vector<bool>(N)); while(M--){ int u,v; cin >> u >> v; G.at(u).at(v) = true; G.at(v).at(u) = true; } bool yes = false; int a,b,c; cin >> a >> b >> c; set<int> S = {a,b,c}; for(int i=0; i<N; i++) for(int k=i+1; k<N; k++){ set<int> now = {i,k}; if(now.size() != 2) continue; if(now == S) continue; //if(G.at(i).at(k) && G.at(k).at(i)) yes = true; } for(int i=0; i<N; i++) for(int k=0; k<N; k++) for(int l=0; l<N; l++){ set<int> now = {i,k,l}; if(now.size() != 3) continue; if(now == S) continue; if(G.at(i).at(k) && G.at(k).at(l) && G.at(l).at(i)) yes = true; } for(int i=0; i<N; i++) for(int k=0; k<N; k++) for(int l=0; l<N; l++) for(int m=0; m<N; m++){ set<int> now = {i,k,l,m}; if(now.size() != 4) continue; if(now == S) continue; if(G.at(i).at(k) && G.at(k).at(l) && G.at(l).at(m) && G.at(m).at(i)) yes = true; } if(yes) cout << "Yes\n"; else cout << "No\n"; }