118992024-11-17 11:53:41SRobHús sütés (75 pont)cpp11Time limit exceeded 9/75400ms1152 KiB

#include <iostream>;
using namespace std;

const int MaxN = 100000;
int main()
{
	int husdb;
	cin >> husdb;
	int sutok[MaxN] = {};
	int voltak[MaxN] = {};
	int max = 0;
	int elozo = 0;
	bool volt_e = false;
	int ismDb;
	ismDb = 0;
	for (int i = 1; i <= husdb; i++)
	{
		cin >> sutok[i-1];
		for (int j = 0; j < i-1; j++)// volt-e már ez a szám
		{
			if (sutok[i-1] == voltak[j])
			{
				volt_e = true;
				//cout<< "ez a szám már volt: "<< sutok[i-1] << endl;
			}
		}
		if (volt_e)// ha volt akkor van egy ismétlésünk
		{
			ismDb++;
			volt_e = false;
		}
		else
		{
			voltak[i-1] = sutok[i-1];// ha nincs akkor hozzáadjuk
		}
		if (sutok[i-1]>max)// közben pedig keressük a maximumot
		{
			max = sutok[i-1];
		}
	}
	cout << ismDb+max;
}

SubtaskSumTestVerdictTimeMemory
base9/75
1Accepted0/02ms1080 KiB
2Accepted0/02ms1080 KiB
3Time limit exceeded0/0384ms1080 KiB
4Accepted3/32ms1080 KiB
5Accepted3/31ms1080 KiB
6Accepted3/32ms1080 KiB
7Wrong answer0/31ms1080 KiB
8Wrong answer0/42ms1080 KiB
9Wrong answer0/41ms1080 KiB
10Wrong answer0/42ms1080 KiB
11Wrong answer0/42ms1080 KiB
12Wrong answer0/42ms1080 KiB
13Time limit exceeded0/4400ms1080 KiB
14Time limit exceeded0/4398ms1152 KiB
15Time limit exceeded0/5400ms1080 KiB
16Time limit exceeded0/5382ms1080 KiB
17Time limit exceeded0/5379ms1096 KiB
18Time limit exceeded0/4400ms1080 KiB
19Time limit exceeded0/4400ms1080 KiB
20Time limit exceeded0/4386ms1080 KiB
21Time limit exceeded0/4384ms1080 KiB
22Time limit exceeded0/2400ms1120 KiB
23Time limit exceeded0/2400ms1080 KiB