118982024-11-17 11:48:19SRobHús sütés (75 pont)cpp11Time limit exceeded 9/75400ms1260 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 < husdb; 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/01ms1080 KiB
2Accepted0/02ms1080 KiB
3Time limit exceeded0/0384ms1080 KiB
4Accepted3/32ms1080 KiB
5Accepted3/31ms1080 KiB
6Accepted3/32ms1084 KiB
7Wrong answer0/32ms1080 KiB
8Wrong answer0/41ms1080 KiB
9Wrong answer0/42ms1148 KiB
10Wrong answer0/42ms1188 KiB
11Wrong answer0/43ms1260 KiB
12Wrong answer0/43ms1076 KiB
13Time limit exceeded0/4400ms1164 KiB
14Time limit exceeded0/4398ms1080 KiB
15Time limit exceeded0/5398ms1080 KiB
16Time limit exceeded0/5384ms1080 KiB
17Time limit exceeded0/5384ms1080 KiB
18Time limit exceeded0/4400ms1084 KiB
19Time limit exceeded0/4400ms1080 KiB
20Time limit exceeded0/4386ms1080 KiB
21Time limit exceeded0/4374ms1080 KiB
22Time limit exceeded0/2400ms1080 KiB
23Time limit exceeded0/2400ms1080 KiB