結果
| 問題 | No.905 Sorted? | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2019-10-25 00:55:52 | 
| 言語 | Ruby (3.4.1) | 
| 結果 | 
                                TLE
                                 
                             | 
| 実行時間 | - | 
| コード長 | 333 bytes | 
| コンパイル時間 | 44 ms | 
| コンパイル使用メモリ | 7,424 KB | 
| 実行使用メモリ | 70,724 KB | 
| 最終ジャッジ日時 | 2024-07-18 09:33:06 | 
| 合計ジャッジ時間 | 5,776 ms | 
| ジャッジサーバーID (参考情報) | judge2 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 8 TLE * 1 -- * 14 | 
コンパイルメッセージ
Syntax OK
ソースコード
N = gets.to_i
A = gets.split.map(&:to_i)
def increase?(diffs)
  diffs.all? { |diff| diff >= 0 }
end
def decrease?(diffs)
  diffs.all? { |diff| diff <= 0 }
end
gets.to_i.times do
  l, r = gets.split.map(&:to_i)
  diffs = A[l..r].each_cons(2).map { |a, b| b - a }
  puts "#{increase?(diffs) ? 1 : 0} #{decrease?(diffs) ? 1 : 0}"
end
            
            
            
        