Submission #6453968


Source Code Expand

Copy
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
typedef long long ll;
static const int INF (1<<30);

int main() {
  int N; cin >> N;
  vector<int> a(N);
  int first = 0, second = 0;
  rep(i, N) {
    int x;
    cin >> x;
    a[i] = x;

    if (x >= first) {
      second = first;
      first = x;
    } else if (x > second) {
      second = x;
    }
  }


  rep(i, N) {
    int y = a[i];
    if (y == first) {
      cout << second << endl;
    } else {
      cout << first << endl;
    }
  }
    

  return 0;
}

Submission Info

Submission Time
Task C - Exception Handling
User straycat
Language C++14 (GCC 5.4.1)
Score 300
Code Size 635 Byte
Status AC
Exec Time 376 ms
Memory 2432 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 367 ms 2432 KB
b07 AC 333 ms 1408 KB
b08 AC 363 ms 2432 KB
b09 AC 368 ms 2176 KB
b10 AC 376 ms 2432 KB
b11 AC 368 ms 2432 KB
b12 AC 364 ms 2176 KB