結果
問題 |
No.1053 ゲーミング棒
|
ユーザー |
![]() |
提出日時 | 2021-01-25 22:56:15 |
言語 | Ruby (3.4.1) |
結果 |
TLE
|
実行時間 | - |
コード長 | 311 bytes |
コンパイル時間 | 519 ms |
コンパイル使用メモリ | 7,424 KB |
実行使用メモリ | 22,784 KB |
最終ジャッジ日時 | 2024-06-22 19:26:05 |
合計ジャッジ時間 | 7,930 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 24 TLE * 1 -- * 9 |
コンパイルメッセージ
Main.rb:29: warning: ambiguous first argument; put parentheses or a space even after `-' operator Syntax OK
ソースコード
N = gets.to_i A = gets.split.map(&:to_i) if N == 1 puts 0 exit end rotate_cnt = 0 while A[0] == A[-1] rotate_cnt += 1 A.rotate! end cnt = 0 (N - 1).times do |i| cnt += 1 if A[i] != A[i + 1] end if cnt == A.uniq.size - 1 if rotate_cnt == 0 puts 0 else puts 1 end else puts -1 end