結果
| 問題 | No.629 グラフの中に眠る門松列 |
| コンテスト | |
| ユーザー |
titia
|
| 提出日時 | 2024-06-10 03:51:20 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
AC
|
| 実行時間 | 46 ms / 4,000 ms |
| コード長 | 544 bytes |
| 記録 | |
| コンパイル時間 | 131 ms |
| コンパイル使用メモリ | 85,120 KB |
| 実行使用メモリ | 68,864 KB |
| 最終ジャッジ日時 | 2026-06-05 01:00:02 |
| 合計ジャッジ時間 | 2,997 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 6 |
| other | AC * 36 |
ソースコード
import sys
input = sys.stdin.readline
N,M=map(int,input().split())
A=list(map(int,input().split()))
E=[[] for i in range(N)]
for i in range(M):
x,y=map(int,input().split())
x-=1
y-=1
E[x].append(y)
E[y].append(x)
for i in range(N):
a=A[i]
for to in E[i]:
b=A[to]
for toto in E[to]:
c=A[toto]
if a<b and b>c and a!=c:
print("YES")
exit()
if a>b and b<c and a!=c:
print("YES")
exit()
print("NO")
titia