結果

問題 No.629 グラフの中に眠る門松列
ユーザー pengin_2000pengin_2000
提出日時 2021-10-31 09:32:02
言語 C
(gcc 12.3.0)
結果
WA  
実行時間 -
コード長 705 bytes
コンパイル時間 323 ms
コンパイル使用メモリ 31,488 KB
実行使用メモリ 5,760 KB
最終ジャッジ日時 2024-04-17 01:41:40
合計ジャッジ時間 2,918 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
5,248 KB
testcase_01 AC 1 ms
5,248 KB
testcase_02 AC 1 ms
5,376 KB
testcase_03 WA -
testcase_04 WA -
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 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 AC 1 ms
5,376 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 1 ms
5,376 KB
testcase_21 AC 75 ms
5,504 KB
testcase_22 WA -
testcase_23 WA -
testcase_24 AC 2 ms
5,376 KB
testcase_25 AC 2 ms
5,376 KB
testcase_26 AC 2 ms
5,376 KB
testcase_27 AC 76 ms
5,760 KB
testcase_28 AC 75 ms
5,504 KB
testcase_29 AC 76 ms
5,632 KB
testcase_30 WA -
testcase_31 AC 76 ms
5,760 KB
testcase_32 WA -
testcase_33 AC 78 ms
5,632 KB
testcase_34 AC 76 ms
5,632 KB
testcase_35 AC 76 ms
5,504 KB
testcase_36 WA -
testcase_37 AC 76 ms
5,504 KB
testcase_38 WA -
testcase_39 WA -
testcase_40 AC 75 ms
5,632 KB
testcase_41 WA -
権限があれば一括ダウンロードができます

ソースコード

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 = i + 1; j < n; j++)
		{
			for (k = j + 1; 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