結果
| 問題 | 
                            No.629 グラフの中に眠る門松列
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2019-06-26 17:11:27 | 
| 言語 | Python3  (3.13.1 + numpy 2.2.1 + scipy 1.14.1)  | 
                    
| 結果 | 
                             
                                RE
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 633 bytes | 
| コンパイル時間 | 193 ms | 
| コンパイル使用メモリ | 12,544 KB | 
| 実行使用メモリ | 11,264 KB | 
| 最終ジャッジ日時 | 2024-06-25 05:49:01 | 
| 合計ジャッジ時間 | 2,844 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge3 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 RE * 3 | 
| other | AC * 24 RE * 12 | 
ソースコード
import sys
N, M = map(int, input().split())
l = list(map(int, input().split())) 
conect_l = [[] for i in range(M)]
for i in range(M):
    node1, node2 = map(int, input().split())
    conect_l[node1 - 1].append(l[node1 - 1] - l[node2 - 1])
    conect_l[node2 - 1].append(l[node2 - 1] - l[node1 - 1])
for i in range(M):
    s = set(conect_l[i])
    ck = list(s)
    posi_n = 0
    nega_n = 0
    for l_i in ck:
        if l_i > 0:
            posi_n += 1
        if l_i < 0:
            nega_n += 1
    if posi_n >= 2:
        print("YES")
        sys.exit()
    if nega_n >= 2:
        print("YES")
        sys.exit()
print("NO")