結果
| 問題 | No.905 Sorted? |
| コンテスト | |
| ユーザー |
maspy
|
| 提出日時 | 2020-01-29 09:41:33 |
| 言語 | Python3 (3.14.3 + numpy 2.4.4 + scipy 1.17.1) |
| 結果 |
AC
|
| 実行時間 | 229 ms / 2,000 ms |
| コード長 | 550 bytes |
| 記録 | |
| コンパイル時間 | 704 ms |
| コンパイル使用メモリ | 20,572 KB |
| 実行使用メモリ | 38,992 KB |
| 最終ジャッジ日時 | 2026-04-04 23:15:07 |
| 合計ジャッジ時間 | 5,689 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge3_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 23 |
ソースコード
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
N = int(readline())
A = list(map(int,readline().split()))
Q = int(readline())
m = map(int,read().split())
LR = zip(m,m)
incr = [0] * N
decr = [0] * N
for i,(x,y) in enumerate(zip(A,A[1:]),1):
incr[i] = incr[i-1] if x <= y else i
decr[i] = decr[i-1] if x >= y else i
answer = []
for L,R in LR:
f = 1 if incr[R] <= L else 0
g = 1 if decr[R] <= L else 0
answer.append('{} {}'.format(f,g))
print('\n'.join(answer))
maspy