Submission #6454645


Source Code Expand

Copy
#include<iostream>
#include<list>
#include<vector>
#include<algorithm>
#include<string>
#include<stdio.h>
#include<math.h>
#include<unordered_map>
#include<map>

using namespace std;
using ll = long long;
using vec = vector<ll>;
using mat = vector<vec>;
using lst = list<ll>;


int main()
{
	int N;
	cin >> N;
	map<int, int> mp;
	vec A(N);

	for (int i = 0; i < N; ++i)
	{
		cin >> A[i];
		mp[A[i]]++;
	}

	int maxV = mp.rbegin()->first;

	for (int i = 0; i < N; ++i)
	{
		if (maxV == A[i] && mp[A[i]] == 1)
		{
			auto itr = mp.rbegin();
			itr++;
			cout << itr->first << endl;
		}
		else
		{
			cout << maxV << endl;
		}
	}

	return 0;
}

Submission Info

Submission Time
Task C - Exception Handling
User mori08
Language C++14 (GCC 5.4.1)
Score 300
Code Size 687 Byte
Status AC
Exec Time 424 ms
Memory 8704 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 369 ms 3200 KB
b07 AC 330 ms 2176 KB
b08 AC 355 ms 3200 KB
b09 AC 362 ms 2944 KB
b10 AC 424 ms 8704 KB
b11 AC 369 ms 3200 KB
b12 AC 358 ms 2944 KB