結果

問題 No.408 五輪ピック
ユーザー FF256grhyFF256grhy
提出日時 2016-08-05 23:46:53
言語 C++11
(gcc 11.4.0)
結果
MLE  
実行時間 -
コード長 856 bytes
コンパイル時間 217 ms
コンパイル使用メモリ 22,912 KB
実行使用メモリ 254,464 KB
最終ジャッジ日時 2024-04-24 19:52:09
合計ジャッジ時間 21,010 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 MLE -
testcase_01 AC 1 ms
5,376 KB
testcase_02 AC 0 ms
5,376 KB
testcase_03 AC 0 ms
5,376 KB
testcase_04 AC 0 ms
5,376 KB
testcase_05 AC 13 ms
6,144 KB
testcase_06 MLE -
testcase_07 MLE -
testcase_08 AC 21 ms
17,152 KB
testcase_09 AC 51 ms
50,688 KB
testcase_10 MLE -
testcase_11 MLE -
testcase_12 MLE -
testcase_13 AC 15 ms
8,064 KB
testcase_14 AC 208 ms
38,144 KB
testcase_15 AC 10 ms
5,376 KB
testcase_16 AC 22 ms
13,440 KB
testcase_17 AC 40 ms
37,888 KB
testcase_18 MLE -
testcase_19 MLE -
testcase_20 MLE -
testcase_21 AC 143 ms
40,832 KB
testcase_22 MLE -
testcase_23 MLE -
testcase_24 MLE -
testcase_25 AC 421 ms
5,376 KB
testcase_26 TLE -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:7:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    7 |         scanf("%d%d", &n, &m);
      |         ~~~~~^~~~~~~~~~~~~~~~
main.cpp:9:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    9 |                 scanf("%d%d", &a[i], &b[i]);
      |                 ~~~~~^~~~~~~~~~~~~~~~~~~~~~

ソースコード

diff #

#include <stdio.h>

int n, m, a[50000], b[50000];
bool c[20000][20000];

int main() {
	scanf("%d%d", &n, &m);
	for(int i = 0; i < m; i++) {
		scanf("%d%d", &a[i], &b[i]);
		a[i]--; b[i]--;
		c[ a[i] ][ b[i] ] = 1;
		c[ b[i] ][ a[i] ] = 1;
	}
	
	bool flag = false;
	for(int i = 0; i < m; i++) {
	for(int j = 0; j < m; j++) {
		if( a[i] == 0 || b[i] == 0 || a[j] == 0 || b[j] == 0 || a[i] == a[j] || a[i] == b[j] || b[i] == a[j] || b[i] == b[j] ) { continue; }
		if(
			(c[0][ a[i] ] == 1 && c[0][ a[j] ] == 1 && c[ b[i] ][ b[j] ] == 1) ||
			(c[0][ a[i] ] == 1 && c[0][ b[j] ] == 1 && c[ b[i] ][ a[j] ] == 1) ||
			(c[0][ b[i] ] == 1 && c[0][ a[j] ] == 1 && c[ a[i] ][ b[j] ] == 1) ||
			(c[0][ b[i] ] == 1 && c[0][ b[j] ] == 1 && c[ a[i] ][ a[j] ] == 1)
		) {
			flag = true;
			i = j = m;
		}

	}
	}
	
	printf("%s\n", flag ? "YES" : "NO");
	
	return 0;
}
0