119042024-11-17 12:51:36SRobHús sütés (75 pont)cpp11Accepted 75/7546ms900 KiB

#include <iostream>;
#include <iterator>;
# include <algorithm>;
#include <array>;
using namespace std;

const int MaxN = 100000;
int main()
{
	int husdb;
	cin >> husdb;
	int sutok[MaxN] = {};
	int max = 0;
	for (int i = 1; i <= husdb; i++)
	{
		cin >> sutok[i-1];
	}
	sort(sutok,sutok + husdb);
	max = sutok[0] + husdb-1;
	for (int i = 1; i < husdb; i++)
	{
		if (sutok[i]+ (husdb-i-1) > max)
		{
			max = sutok[i]+ (husdb-i-1);
		}
			
	}
	cout << max;

}

SubtaskSumTestVerdictTimeMemory
base75/75
1Accepted0/01ms572 KiB
2Accepted0/01ms756 KiB
3Accepted0/023ms572 KiB
4Accepted3/31ms568 KiB
5Accepted3/31ms568 KiB
6Accepted3/31ms568 KiB
7Accepted3/31ms568 KiB
8Accepted4/41ms568 KiB
9Accepted4/41ms568 KiB
10Accepted4/41ms564 KiB
11Accepted4/42ms568 KiB
12Accepted4/42ms788 KiB
13Accepted4/445ms784 KiB
14Accepted4/446ms792 KiB
15Accepted5/545ms796 KiB
16Accepted5/545ms796 KiB
17Accepted5/546ms628 KiB
18Accepted4/445ms796 KiB
19Accepted4/445ms568 KiB
20Accepted4/441ms788 KiB
21Accepted4/432ms788 KiB
22Accepted2/241ms900 KiB
23Accepted2/219ms636 KiB