結果
| 問題 |
No.2710 How many more?
|
| コンテスト | |
| ユーザー |
koncha
|
| 提出日時 | 2024-03-31 14:43:24 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 284 ms / 2,000 ms |
| コード長 | 425 bytes |
| コンパイル時間 | 157 ms |
| コンパイル使用メモリ | 82,164 KB |
| 実行使用メモリ | 106,880 KB |
| 最終ジャッジ日時 | 2024-09-30 19:51:46 |
| 合計ジャッジ時間 | 5,004 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 17 |
ソースコード
N, Q = map(int, input().split())
A = list(map(int, input().split()))
idx = {}
current = min(A)
cnt = 0
total = 0
for x in sorted(A) + [10**10]:
cnt += 1
if x != current:
idx[current] = [total, total+cnt]
total += cnt
cnt = 0
current = x
queries = [list(map(lambda x: int(x)-1, input().split())) for _ in range(Q)]
for x, y in queries:
print(max(idx[A[x]][0] - idx[A[y]][1], 0))
koncha