結果
問題 |
No.2710 How many more?
|
ユーザー |
![]() |
提出日時 | 2024-02-06 21:06:32 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 349 bytes |
コンパイル時間 | 194 ms |
コンパイル使用メモリ | 81,792 KB |
実行使用メモリ | 98,048 KB |
最終ジャッジ日時 | 2024-09-28 12:13:42 |
合計ジャッジ時間 | 7,788 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 5 WA * 12 |
ソースコード
n, q = map(int, input().split()) a = list(map(int, input().split())) tmp = [[a[i], i] for i in range(n)] tmp.sort(reverse = True) ls = [0] * n cnt = 0 for i in range(n): ls[tmp[i][1]] = cnt if i < n - 1 and tmp[i][0] != tmp[i+1][0]: cnt += 1 for _ in range(q): x, y = map(lambda x: int(x)-1, input().split()) print(max(0, ls[y]-ls[x]-1))