結果
問題 |
No.2910 単体ホモロジー入門
|
ユーザー |
|
提出日時 | 2024-10-04 21:35:55 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 1,487 bytes |
コンパイル時間 | 2,164 ms |
コンパイル使用メモリ | 180,620 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-10-04 21:35:59 |
合計ジャッジ時間 | 2,767 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 47 |
ソースコード
#include<bits/stdc++.h> using namespace std; using ll = long long; #define all(a) (a).begin(), (a).end() #define pb push_back #define fi first #define se second mt19937_64 rng(chrono::system_clock::now().time_since_epoch().count()); const ll MOD1000000007 = 1000000007; const ll MOD998244353 = 998244353; const ll MOD[3] = {999727999, 1070777777, 1000000007}; const ll LINF = 1LL << 60LL; const int IINF = (1 << 30) - 2; void solve(){ int n, m; cin >> n >> m; vector<vector<bool>> A(4, vector<bool>(4, false)); for(int i=0; i<m; i++){ int u, v; cin >> u >> v; A[u][v] = A[v][u] = true; } vector<int> x; for(int i=0; i<3; i++){ int tmp; cin >> tmp; x.pb(tmp); } sort(all(x)); x.erase(unique(all(x)), x.end()); vector<int> P(n, 0); for(int i=0; i<4; i++) P[i] = i; do{ // 3頂点 if(A[P[0]][P[1]] && A[P[1]][P[2]] && A[P[2]][P[0]]){ vector<int> vec; for(int i=0; i<3; i++) vec.pb(P[i]); sort(all(vec)); if(vec != x){ cout << "Yes\n"; return; } } // 4頂点 if(A[P[0]][P[1]] && A[P[1]][P[2]] && A[P[2]][P[3]] && A[P[3]][P[0]]){ cout << "Yes\n"; return; } }while(next_permutation(all(P))); cout<< "No\n"; } int main(){ cin.tie(nullptr); ios::sync_with_stdio(false); int T=1; //cin >> T; while(T--) solve(); }