Submission #6454476


Source Code Expand

Copy
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <queue>
#include <cmath>
#include <stack>
#include <set>
#include <map>
typedef long long ll;
using namespace std;

int main(){
  int N;
  cin >> N;
  int a[N];
  for(int i = 0; i < N; i++) cin >> a[i];

  int ind = max_element(a, a + N) - a;
  vector<int> b;
  for(int i = 0; i < N; i++){
    if(i != ind){
      b.push_back(a[i]);
    }
  }

  int mxa = *max_element(a, a + N);
  int mxb = *max_element(b.begin(), b.end());

  //cout << ind << endl;
  for(int i = 0; i < N; i++){
    if(i == ind){
      cout << mxb << endl;
    } else {
      cout << mxa << endl;
    }
  }

  return 0;
}

Submission Info

Submission Time
Task C - Exception Handling
User syawacha
Language C++14 (GCC 5.4.1)
Score 300
Code Size 758 Byte
Status AC
Exec Time 392 ms
Memory 3316 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 1 ms 256 KB
a02 AC 1 ms 256 KB
b03 AC 1 ms 256 KB
b04 AC 1 ms 256 KB
b05 AC 1 ms 256 KB
b06 AC 371 ms 3316 KB
b07 AC 339 ms 2292 KB
b08 AC 365 ms 3316 KB
b09 AC 365 ms 3060 KB
b10 AC 392 ms 3316 KB
b11 AC 371 ms 3316 KB
b12 AC 364 ms 3060 KB