結果

問題 No.1053 ゲーミング棒
ユーザー yuruhiyayuruhiya
提出日時 2020-05-18 13:46:56
言語 Ruby
(3.3.0)
結果
WA  
実行時間 -
コード長 220 bytes
コンパイル時間 297 ms
コンパイル使用メモリ 7,424 KB
実行使用メモリ 26,624 KB
最終ジャッジ日時 2024-04-09 21:27:40
合計ジャッジ時間 5,072 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 77 ms
12,160 KB
testcase_01 AC 74 ms
12,288 KB
testcase_02 AC 71 ms
12,288 KB
testcase_03 AC 72 ms
12,160 KB
testcase_04 AC 71 ms
12,160 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 AC 77 ms
12,160 KB
testcase_12 AC 78 ms
12,160 KB
testcase_13 WA -
testcase_14 AC 81 ms
12,288 KB
testcase_15 AC 81 ms
12,288 KB
testcase_16 AC 74 ms
12,160 KB
testcase_17 AC 73 ms
12,160 KB
testcase_18 AC 74 ms
12,160 KB
testcase_19 WA -
testcase_20 AC 78 ms
12,416 KB
testcase_21 AC 75 ms
12,160 KB
testcase_22 AC 72 ms
12,288 KB
testcase_23 AC 112 ms
22,912 KB
testcase_24 AC 112 ms
22,912 KB
testcase_25 AC 122 ms
26,624 KB
testcase_26 AC 114 ms
22,784 KB
testcase_27 WA -
testcase_28 AC 73 ms
12,160 KB
testcase_29 AC 74 ms
12,160 KB
testcase_30 WA -
testcase_31 AC 117 ms
19,712 KB
testcase_32 AC 115 ms
19,584 KB
testcase_33 AC 114 ms
20,096 KB
testcase_34 AC 115 ms
19,840 KB
testcase_35 WA -
testcase_36 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
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