結果
問題 | No.905 Sorted? |
ユーザー | tonnnura172 |
提出日時 | 2020-04-05 05:04:27 |
言語 | Python3 (3.12.2 + numpy 1.26.4 + scipy 1.12.0) |
結果 |
AC
|
実行時間 | 397 ms / 2,000 ms |
コード長 | 1,066 bytes |
コンパイル時間 | 200 ms |
コンパイル使用メモリ | 10,916 KB |
実行使用メモリ | 25,948 KB |
最終ジャッジ日時 | 2023-10-01 01:04:03 |
合計ジャッジ時間 | 7,764 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge15 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 29 ms
9,552 KB |
testcase_01 | AC | 29 ms
9,660 KB |
testcase_02 | AC | 29 ms
9,664 KB |
testcase_03 | AC | 30 ms
9,664 KB |
testcase_04 | AC | 30 ms
9,712 KB |
testcase_05 | AC | 34 ms
9,872 KB |
testcase_06 | AC | 31 ms
9,748 KB |
testcase_07 | AC | 40 ms
10,572 KB |
testcase_08 | AC | 330 ms
20,048 KB |
testcase_09 | AC | 224 ms
17,588 KB |
testcase_10 | AC | 332 ms
22,772 KB |
testcase_11 | AC | 336 ms
21,268 KB |
testcase_12 | AC | 381 ms
21,724 KB |
testcase_13 | AC | 371 ms
24,064 KB |
testcase_14 | AC | 372 ms
23,964 KB |
testcase_15 | AC | 390 ms
23,912 KB |
testcase_16 | AC | 384 ms
22,808 KB |
testcase_17 | AC | 397 ms
25,948 KB |
testcase_18 | AC | 312 ms
23,284 KB |
testcase_19 | AC | 30 ms
9,660 KB |
testcase_20 | AC | 31 ms
9,484 KB |
testcase_21 | AC | 30 ms
9,576 KB |
testcase_22 | AC | 30 ms
9,660 KB |
ソースコード
import sys, re from collections import deque, defaultdict, Counter from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians from itertools import accumulate, permutations, combinations, product from operator import itemgetter, mul, add from copy import deepcopy from string import ascii_lowercase, ascii_uppercase, digits from bisect import bisect, bisect_left from heapq import heappush, heappop from functools import reduce def input(): return sys.stdin.readline().strip() def INT(): return int(input()) def MAP(): return map(int, input().split()) def LIST(): return list(map(int, input().split())) def ZIP(n): return zip(*(MAP() for _ in range(n))) sys.setrecursionlimit(10 ** 9) INF = float('inf') mod = 10 ** 9 + 7 N = INT() A = LIST() Q = INT() inc = [0]*N dec = [0]*N tmp_inc = 0 tmp_dec = 0 for i in range(1, N): if A[i-1] > A[i]: tmp_inc += 1 inc[i] = tmp_inc if A[i-1] < A[i]: tmp_dec += 1 dec[i] = tmp_dec ans = [] for _ in range(Q): l, r = MAP() ans.append((int(inc[r]==inc[l]), int(dec[r]==dec[l]))) for x in ans: print(*x)