제출 #1321942

#제출 시각아이디문제언어결과실행 시간메모리
1321942rycSnail (NOI18_snail)Pypy 3
0 / 100
1100 ms85656 KiB
import math, sys h, n = map(int,input().split()) p = list(map(int,input().split())) ans = [0, -1] def findHighestPoint(list): cpoint = 0 hpoint = 0 newlist = list.copy()*2 for i in range(len(newlist)): cpoint += newlist[i] if cpoint < 0: cpoint = 0 if cpoint > hpoint: hpoint = cpoint return hpoint SumPhases = sum(p) if SumPhases <= 0 and h - findHighestPoint(p) > 0: print("-1 -1") sys.exit() notDone = True while notDone: if h - findHighestPoint(p) <= 0: checkarr = p*2 ans[1] = -1 for i in range(len(checkarr)): h -= checkarr[i] ans[1] += 1 if h <= 0: notDone = False if i < len(p)-1: print(ans[0], ans[1]) else : ans[0] += 1 ans[1] -= len(p) print(ans[0], ans[1]) break else: h -= SumPhases ans[0] += 1

컴파일 시 표준 출력 (stdout) 메시지

Compiling 'snail.py'...

=======
  adding: __main__.pyc (deflated 35%)

=======
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...