結果
| 問題 | No.1053 ゲーミング棒 |
| コンテスト | |
| ユーザー |
yuruhiya
|
| 提出日時 | 2020-05-18 13:46:56 |
| 言語 | Ruby (4.0.0) |
| 結果 |
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
ソースコード
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
yuruhiya