結果

問題 No.629 グラフの中に眠る門松列
ユーザー むらためむらため
提出日時 2019-01-18 04:42:56
言語 Nim
(2.0.2)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 686 bytes
コンパイル時間 3,279 ms
コンパイル使用メモリ 69,792 KB
実行使用メモリ 4,564 KB
最終ジャッジ日時 2023-09-14 02:08:48
合計ジャッジ時間 4,213 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 1 ms
4,376 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 2 ms
4,376 KB
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 2 ms
4,376 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 AC 2 ms
4,376 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 2 ms
4,376 KB
testcase_21 AC 4 ms
4,384 KB
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 AC 4 ms
4,376 KB
testcase_26 AC 3 ms
4,376 KB
testcase_27 WA -
testcase_28 AC 2 ms
4,380 KB
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 AC 3 ms
4,380 KB
testcase_34 WA -
testcase_35 WA -
testcase_36 WA -
testcase_37 AC 2 ms
4,380 KB
testcase_38 WA -
testcase_39 WA -
testcase_40 AC 2 ms
4,380 KB
testcase_41 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import sequtils
proc getchar_unlocked():char {. importc:"getchar_unlocked",header: "<stdio.h>" .}
proc scan(): int =
  while true:
    var k = getchar_unlocked()
    if k < '0' or k > '9': break
    else: result = 10 * result + k.ord - '0'.ord

let n = scan()
let m = scan()
let A = newSeqWith(n,scan())
let UV = newSeqWith(m,(scan()-1,scan()-1))
var E = newSeqWith(n,newSeq[int]())
for uv in UV:
  E[uv[0]] &= uv[1]
  E[uv[1]] &= uv[0]

for i,dsts in E:
  let y = A[i]
  for j in 0..<dsts.len():
    let x = A[dsts[j]]
    for k in (j+1)..<dsts.len():
      let z = A[dsts[k]]
      if x == z : continue
      if (x < y and y > z) or (x > y and y < z) :
        quit "YES", 0
echo "NO"
0