結果

問題 No.408 五輪ピック
ユーザー kapokapo
提出日時 2016-08-06 14:43:05
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 1,456 bytes
コンパイル時間 932 ms
コンパイル使用メモリ 86,468 KB
実行使用メモリ 816,036 KB
最終ジャッジ日時 2024-04-24 18:25:21
合計ジャッジ時間 4,896 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 3 ms
5,376 KB
testcase_02 WA -
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 2 ms
5,376 KB
testcase_05 MLE -
testcase_06 WA -
testcase_07 AC 34 ms
8,832 KB
testcase_08 AC 49 ms
25,216 KB
testcase_09 AC 34 ms
14,080 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 42 ms
11,136 KB
testcase_13 AC 130 ms
67,712 KB
testcase_14 WA -
testcase_15 MLE -
testcase_16 AC 105 ms
51,072 KB
testcase_17 AC 64 ms
30,464 KB
testcase_18 AC 52 ms
19,328 KB
testcase_19 AC 48 ms
14,336 KB
testcase_20 AC 12 ms
5,376 KB
testcase_21 AC 7 ms
5,376 KB
testcase_22 AC 18 ms
5,632 KB
testcase_23 MLE -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#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[20001];

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);
	}
	rep(i,0,N) {
		for (int a: E1[i]) {
			for (int b: E1[a]) {
				if (b==i) continue;
				E2[i].pb(mp(a,b));
			}
		}
	}
	rep(a1,0,N) {
		for (Pii x: E2[a1]) {
			int a2 = x.first;
			int a3 = x.second;
			for (Pii y: E2[a3]) {
				int b2 = y.first;
				int b3 = y.second;
				if (a1==b2 || a1==b3) continue;
				if (a2==b2 || a2==b3) continue;
				for (int z: E1[b3]) {
					//printf("a1=%d a2=%d a3=%d b2=%d b3=%d z=%d\n",a1,a2,a3,b2,b3,z);
					if (z==a1) {
						cout << "YES" << endl;
						return 0;
					}
				}
			}
		}
	}
	cout << "NO" << endl;
	return 0;
}
0