Submission #49767251


Source Code Expand

import numpy as np
N,M=map(int,input().split())
X=[int(x)-1 for x in input().split()]
B=np.zeros(N)
for x,y in zip(X,X[1:]):
  if y<x:x,y=y,x
  z=y-x
  B+=z
  B[x:y]+=N-z*2
print(int(min(B)))

Submission Info

Submission Time
Task D - Island Tour
User jamad
Language Python (PyPy 3.10-v7.3.12)
Score 0
Code Size 200 Byte
Status TLE
Exec Time 2221 ms
Memory 204920 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 425
Status
AC × 3
AC × 6
TLE × 24
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, 01_random_15.txt, 02_random2_00.txt, 02_random2_01.txt, 02_random2_02.txt, 02_random2_03.txt, 02_random2_04.txt, 02_random2_05.txt, 02_random2_06.txt, 02_random2_07.txt, 03_handmade_00.txt, 03_handmade_01.txt, 03_handmade_02.txt
Case Name Status Exec Time Memory
00_sample_00.txt AC 508 ms 136572 KiB
00_sample_01.txt AC 507 ms 136804 KiB
00_sample_02.txt AC 584 ms 160344 KiB
01_random_00.txt TLE 2020 ms 189376 KiB
01_random_01.txt TLE 2217 ms 172608 KiB
01_random_02.txt TLE 2219 ms 159544 KiB
01_random_03.txt TLE 2219 ms 196424 KiB
01_random_04.txt TLE 2216 ms 157360 KiB
01_random_05.txt TLE 2216 ms 159240 KiB
01_random_06.txt TLE 2216 ms 159056 KiB
01_random_07.txt TLE 2221 ms 204920 KiB
01_random_08.txt TLE 2219 ms 158744 KiB
01_random_09.txt TLE 2219 ms 159148 KiB
01_random_10.txt TLE 2219 ms 159012 KiB
01_random_11.txt TLE 2218 ms 195864 KiB
01_random_12.txt TLE 2216 ms 153136 KiB
01_random_13.txt TLE 2218 ms 200968 KiB
01_random_14.txt TLE 2216 ms 159176 KiB
01_random_15.txt TLE 2216 ms 154632 KiB
02_random2_00.txt TLE 2219 ms 159336 KiB
02_random2_01.txt AC 1225 ms 184240 KiB
02_random2_02.txt TLE 2219 ms 204764 KiB
02_random2_03.txt TLE 2216 ms 159552 KiB
02_random2_04.txt AC 1466 ms 175492 KiB
02_random2_05.txt TLE 2215 ms 152440 KiB
02_random2_06.txt TLE 2217 ms 169652 KiB
02_random2_07.txt TLE 2216 ms 159448 KiB
03_handmade_00.txt TLE 2216 ms 159488 KiB
03_handmade_01.txt TLE 2216 ms 159220 KiB
03_handmade_02.txt AC 488 ms 136772 KiB