AtCoder Beginner Contest 134
翻译中…
Problem Statement
翻译中…
You are given a sequence of length $N$: $A_1, A_2, ..., A_N$. For each integer $i$ between $1$ and $N$ (inclusive), answer the following question:
翻译中…
- Find the maximum value among the
$N-1$elements other than$A_i$in the sequence.
翻译中…
Constraints
翻译中…
$2 \leq N \leq 200000$$1 \leq A_i \leq 200000$- All values in input are integers.
翻译中…
Input
翻译中…
Input is given from Standard Input in the following format:
翻译中…
N
A_1
:
A_N
翻译中…
Output
翻译中…
Print $N$ lines. The $i$-th line ($1 \leq i \leq N$) should contain the maximum value among the $N-1$ elements other than $A_i$ in the sequence.
翻译中…
样例
Input #1
3
1
4
3
Output #1
4
3
4
- The maximum value among the two elements other than $A_1$, that is, $A_2 = 4$ and $A_3 = 3$, is $4$.
- The maximum value among the two elements other than $A_2$, that is, $A_1 = 1$ and $A_3 = 3$, is $3$.
- The maximum value among the two elements other than $A_3$, that is, $A_1 = 1$ and $A_2 = 4$, is $4$.
Input #2
2
5
5
Output #2
5
5
题目信息
题面与样例版权归 AtCoder 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。