結果
| 問題 |
No.905 Sorted?
|
| コンテスト | |
| ユーザー |
ttr
|
| 提出日時 | 2020-02-02 20:19:04 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
AC
|
| 実行時間 | 873 ms / 2,000 ms |
| コード長 | 547 bytes |
| コンパイル時間 | 81 ms |
| コンパイル使用メモリ | 12,800 KB |
| 実行使用メモリ | 21,856 KB |
| 最終ジャッジ日時 | 2024-09-18 21:23:45 |
| 合計ジャッジ時間 | 10,486 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 23 |
ソースコード
N = int(input())
A = [int(a) for a in input().split()]
F = [0]*N
f = 1
G = [0]*N
g = 1
for i in range(N-1):
if A[i+1] >= A[i]:
F[i] = f
F[i+1] = f
else:
f += 1
if A[i+1] <= A[i]:
G[i] = g
G[i+1] = g
else:
g += 1
Q = int(input())
for _ in range(Q):
l,r = map(int, input().split())
if l == r:
print("1 1")
continue
f = 0
g = 0
if F[l] == F[r] and F[l] > 0:
f = 1
if G[l] == G[r] and G[l] > 0:
g = 1
print(str(f)+" "+str(g))
ttr