結果

問題 No.1053 ゲーミング棒
ユーザー yuruhiya
提出日時 2020-05-18 13:46:56
言語 Ruby
(3.4.1)
結果
WA  
実行時間 -
コード長 220 bytes
コンパイル時間 222 ms
コンパイル使用メモリ 7,552 KB
実行使用メモリ 26,752 KB
最終ジャッジ日時 2024-10-01 21:55:21
合計ジャッジ時間 5,980 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 22 WA * 12
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.rb:10: warning: ambiguous first argument; put parentheses or a space even after `-' operator
Syntax OK

ソースコード

diff #

n = gets.to_i
a = gets.split.map &:to_i
s = a.uniq.size
if s == n
	puts 0
elsif a.first == a.last
	b = a[a.index { |i| i != a.first }..a.rindex { |i| i != a.last }]
	puts b.uniq.size == b.size ? 1 : -1
else
	puts -1
end
0