118952024-11-16 15:13:58SRobHús sütés (75 pont)cpp11Wrong answer 6/75400ms1516 KiB

#include <iostream>;

#include <algorithm>;

#include <iterator>;

#include <array>;
using namespace std;

const int MaxN = 100000;
int main()
{
	int husdb;
	cin >> husdb;
	int sutok[MaxN];
	for (int i = 1; i <= husdb; i++)
	{
		cin >> sutok[i-1];
	}
	
	bool vanIsm = false;
	int elozo, ismDb;
	ismDb = 0;
	auto kezd = std::begin(sutok);// iterátor, azaz pointer az első elementre a sutok tömbből
	auto veg = std::begin(sutok)+ (husdb);// utolsó elementre
	std:: sort(kezd,veg);// első és utolsó között sorttol(alapból növekvő sorrend)
	elozo = sutok[0];
	for (int i = 1; i < husdb; i++)
	{
		if (sutok[i] == elozo && sutok[i] !=-1)
		{
			vanIsm = true;
			ismDb++;
				
			sutok[i] = -1;
			i = 1;
			elozo = sutok[0];
		}
		elozo = sutok[i];
	}
		
	int max = 0;
	for (int i = 1; i <= husdb; i++)
	{
		if (sutok[i-1]> max)
		{
			max = sutok[i-1];
		}
	}
	cout << ismDb+max;
	
}


SubtaskSumTestVerdictTimeMemory
base6/75
1Accepted0/01ms512 KiB
2Accepted0/01ms320 KiB
3Wrong answer0/045ms936 KiB
4Accepted3/31ms320 KiB
5Accepted3/31ms320 KiB
6Wrong answer0/31ms320 KiB
7Wrong answer0/31ms320 KiB
8Wrong answer0/41ms500 KiB
9Wrong answer0/41ms320 KiB
10Wrong answer0/41ms500 KiB
11Wrong answer0/41ms332 KiB
12Wrong answer0/41ms320 KiB
13Wrong answer0/4214ms1388 KiB
14Time limit exceeded0/4398ms1260 KiB
15Time limit exceeded0/5400ms1256 KiB
16Time limit exceeded0/5398ms1336 KiB
17Time limit exceeded0/5382ms1336 KiB
18Wrong answer0/4216ms1336 KiB
19Wrong answer0/4216ms1516 KiB
20Time limit exceeded0/4379ms1448 KiB
21Time limit exceeded0/4375ms1080 KiB
22Time limit exceeded0/2400ms1364 KiB
23Time limit exceeded0/2398ms908 KiB