結果

問題 No.629 グラフの中に眠る門松列
ユーザー cielciel
提出日時 2018-01-08 18:57:24
言語 Ruby
(3.3.0)
結果
WA  
実行時間 -
コード長 204 bytes
コンパイル時間 168 ms
コンパイル使用メモリ 11,296 KB
実行使用メモリ 15,648 KB
最終ジャッジ日時 2023-08-25 00:42:55
合計ジャッジ時間 5,754 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 79 ms
15,052 KB
testcase_01 AC 77 ms
15,312 KB
testcase_02 AC 78 ms
15,052 KB
testcase_03 AC 77 ms
15,192 KB
testcase_04 AC 79 ms
15,328 KB
testcase_05 WA -
testcase_06 AC 79 ms
15,140 KB
testcase_07 AC 78 ms
15,296 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 79 ms
15,036 KB
testcase_11 AC 77 ms
15,364 KB
testcase_12 AC 77 ms
15,244 KB
testcase_13 WA -
testcase_14 AC 78 ms
15,032 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 77 ms
15,144 KB
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 AC 85 ms
15,488 KB
testcase_25 AC 85 ms
15,348 KB
testcase_26 AC 86 ms
15,348 KB
testcase_27 WA -
testcase_28 AC 81 ms
15,084 KB
testcase_29 AC 85 ms
15,212 KB
testcase_30 WA -
testcase_31 WA -
testcase_32 AC 84 ms
15,428 KB
testcase_33 AC 87 ms
15,564 KB
testcase_34 AC 83 ms
15,440 KB
testcase_35 AC 85 ms
15,292 KB
testcase_36 WA -
testcase_37 AC 84 ms
15,312 KB
testcase_38 WA -
testcase_39 WA -
testcase_40 AC 82 ms
15,264 KB
testcase_41 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.rb:1: warning: assigned but unused variable - n
Main.rb:1: warning: assigned but unused variable - m
Syntax OK

ソースコード

diff #

(n,m),a,*q=$<.map{|e|e.split.map &:to_i}
h=Hash.new{|h,k|h[k]=[]}
q.each{|u,v|h[u-1]<<v-1;h[v-1]<<u-1}
puts h.any?{|k,v|
	x=y=0
	v.each{|e|
		x+=1 if a[k]<a[e]
		y+=1 if a[k]>a[e]
	}
	x*y>0
} ? :YES : :NO
0