結果
問題 | No.2961 Shiny Monster Master |
ユーザー |
![]() |
提出日時 | 2024-11-16 15:43:25 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 177 ms / 1,777 ms |
コード長 | 1,028 bytes |
コンパイル時間 | 1,293 ms |
コンパイル使用メモリ | 82,048 KB |
実行使用メモリ | 98,688 KB |
最終ジャッジ日時 | 2024-11-16 15:43:41 |
合計ジャッジ時間 | 13,766 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 77 |
ソースコード
from collections import defaultdict, deque, Counter#from functools import cache# import copyfrom itertools import combinations, permutations, product, accumulate, groupby, chain#from more_itertools import distinct_permutationsfrom heapq import heapify, heappop, heappush, heappushpopimport mathimport bisectfrom pprint import pprintfrom random import randint, shuffle, randrange#from sortedcontainers import SortedSet, SortedList, SortedDictimport sys# sys.setrecursionlimit(2000000)input = lambda: sys.stdin.readline().rstrip('\n')inf = float('inf')mod1 = 10**9+7mod2 = 998244353def ceil_div(x, y): return -(-x//y)#################################################R, N = map(int, input().split())A = list(map(int, input().split()))A.sort()A = A+[R+a for a in A]Q = int(input())for _ in range(Q):l, r = map(int, input().split())r += 1p = (r-l)//Rr -= p*Rq = l//Rl -= q*R; r -= q*Rans = N*pans += bisect.bisect_left(A, r)-bisect.bisect_left(A, l)print(ans)