Dies ist mein eigenes Memo.
▼ Frage
▼sample input
python
scores =[3,4,21,36,10,28,35,5,24,42]
▼sample output
python
4 0
▼my answer
python
def breakingRecords(scores):
high=low=scores[0]
xhigh=xlow=0
for i in scores:
if i>high:
xhigh+=1
high=i
elif i<low:
xlow+=1
low=i
ans = [xhigh, xlow]
return ans
if __name__ == '__main__':
fptr = open(os.environ['OUTPUT_PATH'], 'w')
n = int(input())
scores = list(map(int, input().rstrip().split()))
result = breakingRecords(scores)
fptr.write(' '.join(map(str, result)))
fptr.write('\n')
fptr.close()
Recommended Posts