Please sign in first.
Submission #57280853
Source Code Expand
from math import inf n = int(input()) keys = [] for _ in range(n): keys.append(input().split()) keys[-1][0] = int(keys[-1][0]) ans = inf for i in range(1, 101): for j in range(1, 101): l, r = i, j temp = 0 for pos, hand in keys: if hand == 'L': temp += abs(l - pos) l = pos else: temp += abs(r - pos) r = pos ans = min(ans, temp) print(ans)
Submission Info
| Submission Time | |
|---|---|
| Task | B - Piano 3 |
| User | c1ampy |
| Language | Python (CPython 3.11.4) |
| Score | 200 |
| Code Size | 400 Byte |
| Status | AC |
| Exec Time | 218 ms |
| Memory | 8824 KiB |
Judge Result
| Set Name | Sample | All | ||||
|---|---|---|---|---|---|---|
| Score / Max Score | 0 / 0 | 200 / 200 | ||||
| Status |
|
|
| Set Name | Test Cases |
|---|---|
| Sample | 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt |
| All | 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt, 01_random_00.txt, 01_random_01.txt, 01_random_02.txt, 01_random_03.txt, 01_random_04.txt, 01_random_05.txt, 01_random_06.txt, 01_random_07.txt, 01_random_08.txt, 01_random_09.txt, 01_random_10.txt, 01_random_11.txt, 01_random_12.txt, 01_random_13.txt, 01_random_14.txt, 02_handmade_00.txt, 02_handmade_01.txt |
| Case Name | Status | Exec Time | Memory |
|---|---|---|---|
| 00_sample_00.txt | AC | 19 ms | 8716 KiB |
| 00_sample_01.txt | AC | 17 ms | 8616 KiB |
| 00_sample_02.txt | AC | 26 ms | 8684 KiB |
| 01_random_00.txt | AC | 14 ms | 8736 KiB |
| 01_random_01.txt | AC | 169 ms | 8660 KiB |
| 01_random_02.txt | AC | 135 ms | 8768 KiB |
| 01_random_03.txt | AC | 103 ms | 8824 KiB |
| 01_random_04.txt | AC | 202 ms | 8680 KiB |
| 01_random_05.txt | AC | 176 ms | 8764 KiB |
| 01_random_06.txt | AC | 187 ms | 8728 KiB |
| 01_random_07.txt | AC | 204 ms | 8768 KiB |
| 01_random_08.txt | AC | 218 ms | 8728 KiB |
| 01_random_09.txt | AC | 196 ms | 8732 KiB |
| 01_random_10.txt | AC | 193 ms | 8672 KiB |
| 01_random_11.txt | AC | 184 ms | 8696 KiB |
| 01_random_12.txt | AC | 192 ms | 8800 KiB |
| 01_random_13.txt | AC | 180 ms | 8704 KiB |
| 01_random_14.txt | AC | 183 ms | 8724 KiB |
| 02_handmade_00.txt | AC | 160 ms | 8624 KiB |
| 02_handmade_01.txt | AC | 182 ms | 8688 KiB |