https://codeforces.com/group/n75uQpTCBs/contest/325340/problem/A
status: done
List S
is a sublist of the input list a
. Find the maximum length of list S
while S.max()
- S.min()
<= 5.
TLE on test 18
Each round, end
will increase from the former end
, thus passing over unnecessary runs.
ex.
Let's say when start = 1
, end = 6
. When the code proceeds to start = 2
, end = 1 ~ 6
is surplus.
AC
https://codeforces.com/group/n75uQpTCBs/contest/325340/problem/B
status: done
total / 3
2 * total / 3
[1] [2] [3]
sum([1]) = total / 3
sum([2]) + sum([1]) = 2 * total / 3
AC
https://codeforces.com/group/n75uQpTCBs/contest/326285/problem/A
status: undone
N
is even: just start from head and end from tailN
is odd: get all even elements first, then find who is the first
AC