結果

問題 No.629 グラフの中に眠る門松列
ユーザー pengin_2000pengin_2000
提出日時 2021-10-31 09:33:00
言語 C
(gcc 12.3.0)
結果
AC  
実行時間 728 ms / 4,000 ms
コード長 697 bytes
コンパイル時間 160 ms
コンパイル使用メモリ 30,976 KB
実行使用メモリ 5,760 KB
最終ジャッジ日時 2024-04-17 01:43:45
合計ジャッジ時間 13,930 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
5,248 KB
testcase_01 AC 1 ms
5,376 KB
testcase_02 AC 1 ms
5,376 KB
testcase_03 AC 1 ms
5,376 KB
testcase_04 AC 1 ms
5,376 KB
testcase_05 AC 1 ms
5,376 KB
testcase_06 AC 1 ms
5,376 KB
testcase_07 AC 1 ms
5,376 KB
testcase_08 AC 1 ms
5,376 KB
testcase_09 AC 1 ms
5,376 KB
testcase_10 AC 1 ms
5,376 KB
testcase_11 AC 1 ms
5,376 KB
testcase_12 AC 1 ms
5,376 KB
testcase_13 AC 0 ms
5,376 KB
testcase_14 AC 1 ms
5,376 KB
testcase_15 AC 1 ms
5,376 KB
testcase_16 AC 1 ms
5,376 KB
testcase_17 AC 1 ms
5,376 KB
testcase_18 AC 0 ms
5,376 KB
testcase_19 AC 1 ms
5,376 KB
testcase_20 AC 1 ms
5,376 KB
testcase_21 AC 719 ms
5,504 KB
testcase_22 AC 728 ms
5,504 KB
testcase_23 AC 697 ms
5,632 KB
testcase_24 AC 2 ms
5,376 KB
testcase_25 AC 3 ms
5,376 KB
testcase_26 AC 4 ms
5,376 KB
testcase_27 AC 694 ms
5,504 KB
testcase_28 AC 672 ms
5,632 KB
testcase_29 AC 678 ms
5,632 KB
testcase_30 AC 698 ms
5,504 KB
testcase_31 AC 698 ms
5,760 KB
testcase_32 AC 692 ms
5,632 KB
testcase_33 AC 689 ms
5,632 KB
testcase_34 AC 681 ms
5,632 KB
testcase_35 AC 693 ms
5,504 KB
testcase_36 AC 706 ms
5,504 KB
testcase_37 AC 693 ms
5,504 KB
testcase_38 AC 681 ms
5,632 KB
testcase_39 AC 691 ms
5,632 KB
testcase_40 AC 703 ms
5,632 KB
testcase_41 AC 688 ms
5,760 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<stdio.h>
int main()
{
	int n, m;
	scanf("%d %d", &n, &m);
	int i, j, k;
	int a[1003];
	for (i = 0; i < n; i++)
		scanf("%d", &a[i]);
	int u, v;
	int d[1003][1003];
	for (i = 0; i < n; i++)
		for (j = 0; j < n; j++)
			d[i][j] = 0;
	for (i = 0; i < m; i++)
	{
		scanf("%d %d", &u, &v);
		d[u - 1][v - 1] = d[v - 1][u - 1] = 1;
	}
	int f = 0;
	for (i = 0; i < n; i++)
	{
		for (j = 0; j < n; j++)
		{
			for (k = 0; k < n; k++)
			{
				if (d[i][j] == 0 || d[j][k] == 0)
					continue;
				if (a[k] == a[i])
					continue;
				if (a[i]<a[j] && a[j]>a[k])
					f++;
				if (a[i] > a[j] && a[j] < a[k])
					f++;
			}
		}
	}
	if (f > 0)
		printf("YES\n");
	else
		printf("NO\n");
	return 0;
}
0