結果
問題 | No.905 Sorted? |
ユーザー | ああいい |
提出日時 | 2022-05-29 17:53:01 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 362 ms / 2,000 ms |
コード長 | 1,000 bytes |
コンパイル時間 | 249 ms |
コンパイル使用メモリ | 81,848 KB |
実行使用メモリ | 99,196 KB |
最終ジャッジ日時 | 2023-10-21 00:03:05 |
合計ジャッジ時間 | 7,174 ms |
ジャッジサーバーID (参考情報) |
judge15 / judge11 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 39 ms
53,512 KB |
testcase_01 | AC | 41 ms
53,512 KB |
testcase_02 | AC | 39 ms
53,512 KB |
testcase_03 | AC | 40 ms
53,512 KB |
testcase_04 | AC | 40 ms
53,512 KB |
testcase_05 | AC | 76 ms
73,096 KB |
testcase_06 | AC | 54 ms
64,564 KB |
testcase_07 | AC | 85 ms
76,436 KB |
testcase_08 | AC | 340 ms
85,240 KB |
testcase_09 | AC | 248 ms
83,500 KB |
testcase_10 | AC | 322 ms
99,196 KB |
testcase_11 | AC | 326 ms
87,060 KB |
testcase_12 | AC | 362 ms
86,556 KB |
testcase_13 | AC | 350 ms
92,720 KB |
testcase_14 | AC | 353 ms
92,696 KB |
testcase_15 | AC | 324 ms
92,528 KB |
testcase_16 | AC | 320 ms
89,348 KB |
testcase_17 | AC | 327 ms
97,704 KB |
testcase_18 | AC | 270 ms
97,704 KB |
testcase_19 | AC | 39 ms
53,512 KB |
testcase_20 | AC | 41 ms
53,512 KB |
testcase_21 | AC | 39 ms
53,512 KB |
testcase_22 | AC | 38 ms
53,512 KB |
ソースコード
N = int(input()) A = list(map(int,input().split())) Q = int(input()) l = [] left = 0 while left < N: right = left + 1 while right < N and A[right - 1] <= A[right]: right += 1 l.append((left,right - 1)) left = right r = [] left = 0 while left < N: right = left + 1 while right < N and A[right - 1] >= A[right]: right += 1 r.append((left,right - 1)) left = right for _ in range(Q): s,t = map(int,input().split()) start = 0 end = len(l) while end - start > 1: mid = end + start >> 1 if l[mid][0] <= s: start = mid else: end = mid a,b = l[start] if t <= b: print(1,end = " ") else: print(0,end = " ") start = 0 end = len(r) while end - start > 1: mid = end + start >> 1 if r[mid][0] <= s: start = mid else: end = mid a,b = r[start] if t <= b: print(1) else: print(0)