結果

問題 No.408 五輪ピック
ユーザー srup٩(๑`н´๑)۶srup٩(๑`н´๑)۶
提出日時 2016-10-18 18:11:50
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 966 bytes
コンパイル時間 553 ms
コンパイル使用メモリ 69,220 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-05-02 02:41:02
合計ジャッジ時間 1,960 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 2 ms
5,376 KB
testcase_05 AC 22 ms
5,376 KB
testcase_06 AC 15 ms
5,376 KB
testcase_07 AC 23 ms
5,376 KB
testcase_08 AC 19 ms
5,376 KB
testcase_09 AC 19 ms
5,376 KB
testcase_10 AC 16 ms
5,376 KB
testcase_11 AC 15 ms
5,376 KB
testcase_12 AC 25 ms
5,376 KB
testcase_13 AC 22 ms
5,376 KB
testcase_14 AC 7 ms
5,376 KB
testcase_15 AC 23 ms
5,376 KB
testcase_16 AC 26 ms
5,376 KB
testcase_17 AC 27 ms
5,376 KB
testcase_18 AC 30 ms
5,376 KB
testcase_19 AC 29 ms
5,504 KB
testcase_20 AC 8 ms
5,376 KB
testcase_21 AC 6 ms
5,376 KB
testcase_22 AC 14 ms
5,376 KB
testcase_23 AC 34 ms
5,980 KB
testcase_24 WA -
testcase_25 AC 25 ms
5,612 KB
testcase_26 AC 35 ms
5,708 KB
testcase_27 AC 27 ms
5,588 KB
testcase_28 AC 21 ms
5,376 KB
testcase_29 AC 31 ms
5,376 KB
testcase_30 WA -
testcase_31 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <cstdio>
#include <algorithm>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0;i<(n);i++)
const int INF = 1e9;

int n, m;
vector<pair<int, int> > hen;
// set<pair<int, int> > memo;
vector<int> e[20010];// e[u2][u1] := 0 -> u1 -> u2
vector<int> G[20010];
int main(void){
	cin >> n >> m;
	rep(i, m){
		int x, y; cin >> x >> y;
		x--; y--;
		G[x].push_back(y);
		G[y].push_back(x);
		hen.push_back(make_pair(x, y));
		// memo.insert(make_pair(x, y));
		// memo.insert(make_pair(y, x));
	}

	/*
		  0
		/   \
	  u1 	 v1   
		\    |
		 u2-v2

	*/

	for(auto u1 : G[0]){
		for(auto u2 : G[u1]){
			if(u1 != u2 && u2 != 0){
				e[u2].push_back(u1);
			}
		}
	}

	for(auto d : hen){
		int u2 = d.first, v2 = d.second;
		for(auto u1 : e[u2]){
			for(auto v1 : e[v2]){
				if(u1 != v1){
					printf("YES\n");
					return 0;
				}
			}
		}

	}

	printf("NO\n");
	return 0;
}
0