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()
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
15 ms |
2 KB |
Output is correct |
2 |
Correct |
14 ms |
2 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
16 ms |
2 KB |
Output is correct |
2 |
Correct |
14 ms |
2 KB |
Output is correct |
3 |
Correct |
16 ms |
2 KB |
Output is correct |
4 |
Correct |
15 ms |
2 KB |
Output is correct |
5 |
Correct |
14 ms |
2 KB |
Output is correct |
6 |
Correct |
15 ms |
2 KB |
Output is correct |
7 |
Correct |
16 ms |
2 KB |
Output is correct |
8 |
Correct |
20 ms |
2 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
14 ms |
2 KB |
Output is correct |
2 |
Correct |
19 ms |
2 KB |
Output is correct |
3 |
Correct |
13 ms |
2 KB |
Output is correct |
4 |
Correct |
15 ms |
2 KB |
Output is correct |
5 |
Correct |
14 ms |
2 KB |
Output is correct |
6 |
Correct |
18 ms |
2 KB |
Output is correct |
7 |
Correct |
15 ms |
2 KB |
Output is correct |
8 |
Correct |
17 ms |
2 KB |
Output is correct |
9 |
Correct |
22 ms |
2 KB |
Output is correct |
10 |
Correct |
13 ms |
2 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
16 ms |
2 KB |
Output is correct |
2 |
Correct |
18 ms |
2 KB |
Output is correct |
3 |
Correct |
20 ms |
2 KB |
Output is correct |
4 |
Correct |
20 ms |
3 KB |
Output is correct |
5 |
Correct |
21 ms |
3 KB |
Output is correct |
6 |
Correct |
22 ms |
3 KB |
Output is correct |
7 |
Correct |
24 ms |
3 KB |
Output is correct |
8 |
Correct |
21 ms |
3 KB |
Output is correct |
9 |
Correct |
37 ms |
3 KB |
Output is correct |
10 |
Correct |
24 ms |
3 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
173 ms |
13 KB |
Execution failed because the return code was nonzero |
2 |
Halted |
0 ms |
0 KB |
- |