# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
753112 |
2023-06-04T15:57:53 Z |
teerapat_ |
Pairs (IOI07_pairs) |
Python 3 |
|
836 ms |
524288 KB |
import math
answer = 0
B, N, D, M = map(int, input().split())
px = [0] * N
py = [0] * N
pz = [0] * N
p_range = [[0] * N for i in range(N)]
if B == 1:
for i in range(N):
px[i] = int(input())
px.sort()
for i in range(N):
aux = px[i]
for j in range(i+1, N):
aux = abs(px[i] - px[j])
if aux <= D:
answer += 1
elif B == 2 :
for i in range(N):
px[i], py[i] = map(int, input().split())
for i in range(N):
for j in range(i+1, N):
temp_aux = math.sqrt(math.pow(px[i] - px[j], 2) + math.pow(py[i] - py[j], 2))
aux = round(temp_aux)
# print(f'{str(px[i])},{str(py[i])}', f'{str(px[j])},{str(py[j])}', 'aux:',aux, 'D:', D)
if temp_aux < aux:
aux += 1
if aux <= D:
answer += 1
elif B == 3:
for i in range(N):
px[i], py[i], pz[i] = map(int, input().split())
for i in range(N):
for j in range(i+1, N):
temp_aux = math.sqrt(math.pow(px[i] - px[j], 2) + math.pow(py[i] - py[j], 2) + math.pow(pz[i] - pz[j], 2))
aux = round(temp_aux)
# print(f'{str(px[i])},{str(py[i])}', f'{str(px[j])},{str(py[j])}', 'aux:',aux, 'D:', D)
if temp_aux < aux:
aux += 1
if aux <= D:
answer += 1
print(answer)
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
14 ms |
2972 KB |
Output is correct |
2 |
Correct |
15 ms |
2904 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
186 ms |
10936 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
252 ms |
524288 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
230 ms |
524288 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
231 ms |
524288 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
682 ms |
11008 KB |
Output is correct |
2 |
Incorrect |
667 ms |
10968 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
240 ms |
524288 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
240 ms |
524288 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
253 ms |
524288 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
836 ms |
10920 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
216 ms |
524288 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
229 ms |
524288 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
229 ms |
524288 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |