Submission #52883361
Source Code Expand
n = int(input()) even, odd = [], [] for _ in range(n): x, y = map(int, input().split()) if (x+y)%2==0: even.append(((x+y)//2, (y-x)//2)) else: y -= 1 odd.append(((x+y)//2, (y-x)//2)) ans = 0 def get_ans(pts): n = len(pts) px_sort = sorted(pts) temp = 0 for i in range(n-1): temp += (px_sort[i+1][0]-px_sort[i][0]) * (i+1) * (n-1-i) py_sort = sorted(pts, key=lambda x: x[1]) for i in range(n-1): temp += (py_sort[i+1][1]-py_sort[i][1]) * (i+1) * (n-1-i) return temp print(get_ans(even) + get_ans(odd))
Submission Info
| Submission Time | |
|---|---|
| Task | E - Jump Distance Sum |
| User | Nekomancer60 |
| Language | Python (PyPy 3.10-v7.3.12) |
| Score | 500 |
| Code Size | 568 Byte |
| Status | AC |
| Exec Time | 527 ms |
| Memory | 104956 KiB |
Judge Result
| Set Name | Sample | All | ||||
|---|---|---|---|---|---|---|
| Score / Max Score | 0 / 0 | 500 / 500 | ||||
| Status |
|
|
| Set Name | Test Cases |
|---|---|
| Sample | example_00.txt, example_01.txt |
| All | example_00.txt, example_01.txt, hand_00.txt, hand_01.txt, hand_02.txt, hand_03.txt, hand_04.txt, random_00.txt, random_01.txt, random_02.txt, random_03.txt, random_04.txt, random_05.txt, random_06.txt, random_07.txt, random_08.txt, random_09.txt, random_10.txt, random_11.txt, random_12.txt, random_13.txt, random_14.txt, random_15.txt, random_16.txt, random_17.txt, random_18.txt, random_19.txt |
| Case Name | Status | Exec Time | Memory |
|---|---|---|---|
| example_00.txt | AC | 56 ms | 76460 KiB |
| example_01.txt | AC | 56 ms | 76760 KiB |
| hand_00.txt | AC | 487 ms | 98988 KiB |
| hand_01.txt | AC | 56 ms | 76464 KiB |
| hand_02.txt | AC | 520 ms | 100076 KiB |
| hand_03.txt | AC | 512 ms | 99460 KiB |
| hand_04.txt | AC | 55 ms | 76440 KiB |
| random_00.txt | AC | 505 ms | 104064 KiB |
| random_01.txt | AC | 503 ms | 104816 KiB |
| random_02.txt | AC | 506 ms | 104524 KiB |
| random_03.txt | AC | 506 ms | 104204 KiB |
| random_04.txt | AC | 505 ms | 103964 KiB |
| random_05.txt | AC | 504 ms | 104380 KiB |
| random_06.txt | AC | 507 ms | 104456 KiB |
| random_07.txt | AC | 503 ms | 103468 KiB |
| random_08.txt | AC | 498 ms | 104956 KiB |
| random_09.txt | AC | 504 ms | 104896 KiB |
| random_10.txt | AC | 501 ms | 102612 KiB |
| random_11.txt | AC | 502 ms | 104580 KiB |
| random_12.txt | AC | 499 ms | 103204 KiB |
| random_13.txt | AC | 504 ms | 102624 KiB |
| random_14.txt | AC | 514 ms | 100276 KiB |
| random_15.txt | AC | 520 ms | 99484 KiB |
| random_16.txt | AC | 522 ms | 99824 KiB |
| random_17.txt | AC | 527 ms | 100072 KiB |
| random_18.txt | AC | 522 ms | 99916 KiB |
| random_19.txt | AC | 523 ms | 100808 KiB |