結果

問題 No.408 五輪ピック
ユーザー FF256grhyFF256grhy
提出日時 2017-01-22 20:34:48
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 464 bytes
コンパイル時間 541 ms
コンパイル使用メモリ 52,188 KB
実行使用メモリ 4,504 KB
最終ジャッジ日時 2023-08-24 20:04:36
合計ジャッジ時間 2,883 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 20 ms
4,376 KB
testcase_06 WA -
testcase_07 AC 19 ms
4,376 KB
testcase_08 AC 16 ms
4,380 KB
testcase_09 AC 17 ms
4,380 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 21 ms
4,380 KB
testcase_13 AC 20 ms
4,376 KB
testcase_14 WA -
testcase_15 AC 21 ms
4,376 KB
testcase_16 AC 23 ms
4,376 KB
testcase_17 AC 23 ms
4,380 KB
testcase_18 AC 24 ms
4,376 KB
testcase_19 AC 25 ms
4,376 KB
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 25 ms
4,504 KB
testcase_24 WA -
testcase_25 AC 20 ms
4,376 KB
testcase_26 WA -
testcase_27 WA -
testcase_28 AC 15 ms
4,380 KB
testcase_29 AC 15 ms
4,376 KB
testcase_30 AC 2 ms
4,376 KB
testcase_31 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#define I for(int i=0;i<m;i++)
int n,m,a[50000],b[50000],c[20000],d[20000],e;
int main(){
	std::cin>>n>>m;
	I{std::cin>>a[i]>>b[i];a[i]--;b[i]--;}
	I c[b[i]]|=a[i],c[a[i]]|=b[i];
	I{
		if(a[i]&&c[b[i]])d[a[i]]=d[a[i]]==0?b[i]:-1;
		if(b[i]&&c[a[i]])d[b[i]]=d[b[i]]==0?a[i]:-1;
	}
	I{
		if(!d[a[i]]||!d[b[i]]||d[a[i]]==b[i]||d[b[i]]==a[i])continue;
		if(d[a[i]]==-1||d[b[i]]==-1||d[a[i]]!=d[b[i]])e=1;
	}
	std::cout<<(e?"YES":"NO");
	return 0;
}
0