結果
問題 |
No.408 五輪ピック
|
ユーザー |
![]() |
提出日時 | 2016-08-06 16:19:46 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 1,306 bytes |
コンパイル時間 | 772 ms |
コンパイル使用メモリ | 86,896 KB |
実行使用メモリ | 11,808 KB |
最終ジャッジ日時 | 2024-11-07 03:59:41 |
合計ジャッジ時間 | 10,087 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 27 TLE * 1 -- * 4 |
ソースコード
#define _CRT_SECURE_NO_WARNINGS // #pragma warning(disable:4996) #include <iostream> #include <cstdio> #include <algorithm> #include <vector> #include <string> #include <queue> #include <functional> #include <sstream> #include <cmath> #include <set> #include <map> using namespace std; #define rep(i,a,b) for(int i=(a);i<(b);i++) #define pb push_back #define mp(a,b) make_pair(a,b) #define all(a) a.begin(),a.end() #define len(x) ((int)(x).size()) #define tmax(a,b,c) max((a),max((b),(c))) #define debug(x) cerr << #x << " is " << x << endl; typedef pair<int, int> Pii; typedef vector<int> V; typedef vector<vector<int> > VV; typedef long long ll; const int inf = 2e9; const int mod = 1e9 + 7; const long double eps = 1e-10; int N, M; V E1[20001]; vector<Pii> E2; int main() { cin >> N >> M; rep(i,0,M) { int a, b; cin >> a >> b; a--; b--; E1[a].pb(b); E1[b].pb(a); } for (int b: E1[0]) { for (int c: E1[b]) { if (c==0) continue; E2.pb(mp(b,c)); } } rep(i,0,len(E2)-1) { rep(j,i,len(E2)) { int b = E2[i].first; int c = E2[i].second; int d = E2[j].second; int e = E2[j].first; if (b==d || b==e || c==d || c==e) continue; for (auto x: E1[c]) { if (x==d) { cout << "YES" << endl; return 0; } } } } cout << "NO" << endl; return 0; }