Submission #9857006


Source Code Expand

Copy
from scipy.optimize import minimize_scalar


def main() -> None:
    _ = int(input())
    A = [int(x) for x in input().split()]

    def f(x, A=A):
        return sum(abs(a - (x + i + 1)) for i, a in enumerate(A))

    print(int(minimize_scalar(f, method="golden", tol=0.1).fun + 0.1))


if __name__ == '__main__':
    main()

Submission Info

Submission Time
Task C - Linear Approximation
User n_knuu
Language Python (3.4.3)
Score 0
Code Size 341 Byte
Status WA
Exec Time 1587 ms
Memory 39556 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 300
Status
AC × 4
AC × 8
WA × 11
Set Name Test Cases
Sample sample_01.txt, sample_02.txt, sample_03.txt, sample_04.txt
All sample_01.txt, sample_02.txt, sample_03.txt, sample_04.txt, sample_01.txt, sample_02.txt, sample_03.txt, sample_04.txt, subtask_1_01.txt, subtask_1_02.txt, subtask_1_03.txt, subtask_1_04.txt, subtask_1_05.txt, subtask_1_06.txt, subtask_1_07.txt, subtask_1_08.txt, subtask_1_09.txt, subtask_1_10.txt, subtask_1_11.txt
Case Name Status Exec Time Memory
sample_01.txt AC 237 ms 17428 KB
sample_02.txt AC 237 ms 17428 KB
sample_03.txt AC 237 ms 17428 KB
sample_04.txt AC 240 ms 17428 KB
subtask_1_01.txt WA 238 ms 17428 KB
subtask_1_02.txt WA 412 ms 21460 KB
subtask_1_03.txt WA 393 ms 20976 KB
subtask_1_04.txt WA 705 ms 28256 KB
subtask_1_05.txt WA 1578 ms 36584 KB
subtask_1_06.txt WA 1587 ms 39340 KB
subtask_1_07.txt WA 1390 ms 39556 KB
subtask_1_08.txt WA 1360 ms 39484 KB
subtask_1_09.txt WA 1430 ms 39488 KB
subtask_1_10.txt WA 1578 ms 39536 KB
subtask_1_11.txt WA 1587 ms 39536 KB