結果
| 問題 | 
                            No.629 グラフの中に眠る門松列
                             | 
                    
| コンテスト | |
| ユーザー | 
                             Bioinfo_K
                         | 
                    
| 提出日時 | 2018-01-05 22:40:22 | 
| 言語 | Python3  (3.13.1 + numpy 2.2.1 + scipy 1.14.1)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 546 bytes | 
| コンパイル時間 | 418 ms | 
| コンパイル使用メモリ | 12,672 KB | 
| 実行使用メモリ | 11,136 KB | 
| 最終ジャッジ日時 | 2024-12-23 06:53:18 | 
| 合計ジャッジ時間 | 3,292 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge1 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 6 | 
| other | AC * 28 WA * 8 | 
ソースコード
import sys,collections
from operator import itemgetter
sys.setrecursionlimit(10**7)
def Is(): return [int(x) for x in sys.stdin.readline().split()]
def Ss(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def S(): return input()
n,m = Is()
As = Is()
g = [[] for i in range(n+1)]
for i in range(m):
    u,v = Is()
    g[u].append(v)
    g[v].append(u)
for i,a in enumerate(As):
    if len(g[i+1]) >= 2:
        if min([a]+g[i+1]) == a or max([a]+g[i+1]) == a:
            print("YES")
            exit()
print("NO")
            
            
            
        
            
Bioinfo_K