Rezultati

Up. imeNalogaJezikRezultatČas oddaje
rektifikatorji-2018 Nič nas ne sme presenetiti! C++ 0/100Prekoračen čas (TLE) 19. apr '18 @ 18:40

Test Točke Porabljen spomin Porabljen čas Status
#1 12/12 3,035 MiB 0,000 s OK
#2 12/12 3,176 MiB 0,000 s OK
#3 12/12 3,105 MiB 0,004 s OK
#4 0/12 8,820 MiB 4,541 s Prekoračen čas
#5 13/13 3,180 MiB 0,004 s OK
#6 13/13 8,379 MiB 0,245 s OK
#7 13/13 8,516 MiB 0,000 s OK
#8 0/13 5,766 MiB 4,135 s Prekoračen čas

Ocenjevani program (Source.cpp):
#include <iostream>
#include <vector>

using namespace std;

int main()
{
	int n, q;
	cin >> n >> q;

	vector<int>* mat = new vector<int>[n + 1];

	int a, b;
	for (int i = 0; i != n - 1; i++)
	{
		cin >> a >> b;
		mat[a].push_back(b);
	}

	int m;
	for (int i = 0; i != q; i++)
	{
		cin >> m;

		vector<int> rebels;
		int x;
		for (int j = 0; j != m; j++)
		{
			cin >> x;
			rebels.push_back(x);
		}

		// preveri scenarij
		int road_cnt = 0;
		int rebel_cnt = rebels.size();
		for (int j = 0; j != rebel_cnt; j++)
		{
			// sprehod skozi sosede
			for (int r = 0; r != mat[rebels[j]].size(); r++)
			{
				// preveri, �e je kateri sosed od na�e target mno�ice
				int current = mat[rebels[j]][r];
				for (int p = 0; p != rebel_cnt; p++)
				{
					if (current == rebels[p])
						road_cnt++;
				}
			}
		}

		if (road_cnt == rebel_cnt - 1)
			cout << "ALAAAARHM" << endl;
		else
			cout << "NASLEDNJI" << endl;
	}


	//system("pause");
	return 0;
}