Created
April 24, 2021 01:26
-
-
Save nuriyevn/4e543a89344e64f86d174f622287411a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if __name__ == '__main__': | |
n = int(raw_input()) | |
arr = map(int, raw_input().split()) | |
maximum = arr[0] | |
last_max = None | |
for i in range(1, len(arr)): | |
#знаходимо максимальний максимум | |
if arr[i] > maximum: | |
if maximum != last_max: | |
last_max = maximum | |
maximum = arr[i] | |
#знаходимо друний максимум Runner-Up | |
if last_max == None: | |
if arr[i] != maximum: | |
last_max = arr[i] | |
else: | |
if arr[i] > last_max and arr[i] < maximum: | |
last_max = arr[i] | |
print(last_max) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment