結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
5,248 KB
testcase_01 AC 0 ms
5,376 KB
testcase_02 AC 1 ms
5,376 KB
testcase_03 AC 1 ms
5,376 KB
testcase_04 AC 0 ms
5,376 KB
testcase_05 AC 21 ms
8,448 KB
testcase_06 MLE -
testcase_07 MLE -
testcase_08 AC 36 ms
33,920 KB
testcase_09 MLE -
testcase_10 MLE -
testcase_11 MLE -
testcase_12 MLE -
testcase_13 AC 24 ms
12,416 KB
testcase_14 AC 244 ms
54,400 KB
testcase_15 AC 13 ms
5,376 KB
testcase_16 AC 36 ms
24,960 KB
testcase_17 MLE -
testcase_18 MLE -
testcase_19 MLE -
testcase_20 MLE -
testcase_21 AC 168 ms
50,048 KB
testcase_22 MLE -
testcase_23 MLE -
testcase_24 MLE -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:6:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    6 |         scanf("%d%d", &n, &m);
      |         ~~~~~^~~~~~~~~~~~~~~~
main.cpp:8:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    8 |                 scanf("%d%d", &a[i], &b[i]);
      |                 ~~~~~^~~~~~~~~~~~~~~~~~~~~~

ソースコード

diff #

#include <stdio.h>

int n, m, a[50000], b[50000], 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