結果
| 問題 | No.905 Sorted? |
| コンテスト | |
| ユーザー |
takakin
|
| 提出日時 | 2020-06-15 22:38:57 |
| 言語 | Python3 (3.14.3 + numpy 2.4.2 + scipy 1.17.0) |
| 結果 |
AC
|
| 実行時間 | 317 ms / 2,000 ms |
| コード長 | 437 bytes |
| 記録 | |
| コンパイル時間 | 489 ms |
| コンパイル使用メモリ | 20,740 KB |
| 実行使用メモリ | 26,516 KB |
| 最終ジャッジ日時 | 2026-03-24 19:45:44 |
| 合計ジャッジ時間 | 6,293 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 23 |
ソースコード
import sys,heapq
input = sys.stdin.buffer.readline
n=int(input())
A=[int(i) for i in input().split()]
I,D=[0],[0]
for i in range(1,n):
if A[i]>=A[i-1]:
I.append(I[-1]+1)
else:
I.append(I[-1])
if A[i]<=A[i-1]:
D.append(D[-1]+1)
else:
D.append(D[-1])
q=int(input())
for _ in range(q):
l,r=map(int,input().split())
ans1,ans2=0,0
if r-l==I[r]-I[l]:
ans1=1
if r-l==D[r]-D[l]:
ans2=1
print(ans1,ans2)
takakin