This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
def main():
m, n, l = map(int, raw_input().split())
s = map(int, raw_input().split())
a = []
for i in range (n) :
h = map(int, raw_input().split())
a.append(h[::])
a.sort()
s.sort()
answer = 0
j = 0
for i in range (n) :
while (j<m) and s[j] < a[i][0] :
j+=1
flag = False
if (j > 0) and (a[i][0] - s[j-1] + a[i][1] <= l) : flag = True
if (j < m) and (s[j] - a[i][0] + a[i][1] <= l) : flag = True
if flag : answer += 1
print answer
return
main()
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |