結果

問題 No.408 五輪ピック
ユーザー sugim48sugim48
提出日時 2016-08-05 22:34:00
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,331 bytes
コンパイル時間 1,159 ms
コンパイル使用メモリ 109,668 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-24 15:48:30
合計ジャッジ時間 12,175 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
5,248 KB
testcase_01 AC 4 ms
5,376 KB
testcase_02 AC 5 ms
5,376 KB
testcase_03 AC 1 ms
5,376 KB
testcase_04 AC 1 ms
5,376 KB
testcase_05 AC 10 ms
5,376 KB
testcase_06 AC 1,422 ms
5,376 KB
testcase_07 AC 15 ms
5,376 KB
testcase_08 AC 8 ms
5,376 KB
testcase_09 AC 9 ms
5,376 KB
testcase_10 AC 930 ms
5,376 KB
testcase_11 AC 793 ms
5,376 KB
testcase_12 AC 18 ms
5,376 KB
testcase_13 AC 10 ms
5,376 KB
testcase_14 AC 442 ms
5,376 KB
testcase_15 AC 10 ms
5,376 KB
testcase_16 AC 12 ms
5,376 KB
testcase_17 AC 12 ms
5,376 KB
testcase_18 AC 14 ms
5,376 KB
testcase_19 AC 16 ms
5,376 KB
testcase_20 AC 851 ms
5,376 KB
testcase_21 AC 473 ms
5,376 KB
testcase_22 AC 1,579 ms
5,376 KB
testcase_23 AC 15 ms
5,376 KB
testcase_24 WA -
testcase_25 AC 14 ms
5,376 KB
testcase_26 AC 1,457 ms
5,376 KB
testcase_27 AC 1,548 ms
5,376 KB
testcase_28 AC 29 ms
5,376 KB
testcase_29 AC 59 ms
5,376 KB
testcase_30 WA -
testcase_31 AC 4 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#define _USE_MATH_DEFINES
#include <algorithm>
#include <cstdio>
#include <functional>
#include <iostream>
#include <cfloat>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <time.h>
#include <vector>
#include <random>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> i_i;
typedef pair<ll, int> ll_i;
typedef pair<double, int> d_i;
typedef pair<ll, ll> ll_ll;
typedef pair<double, double> d_d;
struct edge { int u, v; ll w; };

ll MOD = 1000000007;
ll _MOD = 1000000009;
double EPS = 1e-10;

int main() {
	random_device rd;
	mt19937 mt(rd());
	int N, M; cin >> N >> M;
	vector<vector<int> > G(N);
	while (M--) {
		int u, v; scanf("%d%d", &u, &v);
		u--; v--;
		G[u].push_back(v);
		G[v].push_back(u);
	}
	for (int t = 0; t < 10000; t++) {
		vector<int> color(N);
		for (int u = 0; u < N; u++)
			color[u] = mt() % 4;
		vector<bool> a(N);
		a[0] = true;
		for (int c = 0; c < 4; c++) {
			vector<bool> _a(N);
			for (int u = 0; u < N; u++)
				if (a[u])
					for (int v: G[u])
						if (color[v] == c)
							_a[v] = true;
			a = _a;
		}
		for (int v: G[0])
			if (a[v]) {
				cout << "YES" << endl;
				return 0;
			}
	}
	cout << "NO" << endl;
}
0