Submission #6452217


Source Code Expand

Copy
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define mkp make_pair
#define rep(i,s,f) for(i=s;i<f;i++)
#define db cout<<'h'<<'i'<<endl 
#define pb push_back
#define pii pair<int,int>
#define F first
#define S second
#define vi vector<int>
#define vii vector<pair<int,int>>
#define boost ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define PI 3.14159265
#define mod 1000000007
#define mod2 998244353
#define space 300005
#define lg 18
//<<fixed << setprecision(9)

int main()
{
    int n,i,j,t;
    boost;

    cin>>n;
    int arr[n];
    int hs[space]={0};
    rep(i,0,n)
    {
        cin>>arr[i];
        hs[arr[i]]=i;
    }
    sort(arr,arr+n);
    if(arr[n-1]==arr[n-2])
    {
        rep(i,0,n)
        {
            cout<<arr[n-1]<<"\n";
        }
    }
    else
    {
        rep(i,0,n)
        {
            if(i==hs[arr[n-1]]) cout<<arr[n-2]<<'\n';
            else cout<<arr[n-1]<<'\n';
        }
    }
    return 0;
}

Submission Info

Submission Time
Task C - Exception Handling
User fros7_
Language C++14 (GCC 5.4.1)
Score 300
Code Size 1020 Byte
Status AC
Exec Time 48 ms
Memory 3584 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 300 / 300
Status
AC × 2
AC × 12
Set Name Test Cases
Sample a01, a02
All a01, a02, b03, b04, b05, b06, b07, b08, b09, b10, b11, b12
Case Name Status Exec Time Memory
a01 AC 2 ms 1408 KB
a02 AC 2 ms 1408 KB
b03 AC 2 ms 1408 KB
b04 AC 2 ms 1408 KB
b05 AC 2 ms 1408 KB
b06 AC 36 ms 3584 KB
b07 AC 29 ms 2560 KB
b08 AC 35 ms 3584 KB
b09 AC 34 ms 3328 KB
b10 AC 48 ms 3584 KB
b11 AC 38 ms 3584 KB
b12 AC 34 ms 3328 KB