목차

My Cow Ate My Homework

ps
링크acmicpc.net/…
출처BOJ
문제 번호15460
문제명My Cow Ate My Homework
레벨실버 2
시간복잡도O(n)
인풋사이즈n<=100,000
사용한 언어Python 3.11
제출기록41316KB / 108ms
최고기록108ms
해결날짜2023/07/24

풀이

코드

"""Solution code for "BOJ 15460. My Cow Ate My Homework".

- Problem link: https://www.acmicpc.net/problem/15460
- Solution link: http://www.teferi.net/ps/problems/boj/15460
"""


INF = float('inf')


def main():
    N = int(input())
    scores = [int(x) for x in input().split()]

    lowest = total = scores[-1]
    score_by_k = [-INF] * N
    for count, score in enumerate(scores[-2:0:-1], start=2):
        lowest = min(lowest, score)
        total += score
        score_by_k[N - count] = (total - lowest) / (count - 1)
    max_score = max(score_by_k)

    print(*(k for k, score in enumerate(score_by_k) if score == max_score))


if __name__ == '__main__':
    main()