結果
| 問題 | No.629 グラフの中に眠る門松列 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2018-01-23 12:08:14 |
| 言語 | PyPy2 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 111 ms / 4,000 ms |
| コード長 | 403 bytes |
| 記録 | |
| コンパイル時間 | 136 ms |
| コンパイル使用メモリ | 77,204 KB |
| 最終ジャッジ日時 | 2025-12-04 00:54:22 |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 6 |
| other | AC * 36 |
ソースコード
#yuki629 N,M=map(int,raw_input().split()) A=map(int,raw_input().split()) E=[[] for i in xrange(N)] for i in xrange(M): a,b=map(int,raw_input().split()) a,b=a-1,b-1 E[a].append(b) E[b].append(a) res='NO' for cu in xrange(N): up=set() dn=set() for to in E[cu]: if A[cu]<A[to]: up.add(A[to]) if A[cu]>A[to]: dn.add(A[to]) if len(up)>=2: res='YES' if len(dn)>=2: res='YES' print res