Submission #57866

# Submission time Handle Problem Language Result Execution time Memory
57866 2018-07-16T12:44:01 Z MatheusLealV ICC (CEOI16_icc) C++17
18 / 100
492 ms 860 KB
#include "icc.h"
#define N 105
#include <bits/stdc++.h>
using namespace std;

set<int> grafo[N];

int pai[N], peso[N];

int Find(int x)
{
	if(x == pai[x]) return x;

	return pai[x] = Find(pai[x]);
}

void join(int a, int b)
{
	a = Find(a), b = Find(b);

	if(a == b) return;

	if(peso[a] > peso[b]) pai[b] = a;

	else if(peso[a] < peso[b]) pai[a] = b;

	else pai[a] = b, peso[b] ++; 
}

void run(int n)
{
	for(int i = 1; i <= n; i++)
	{
		pai[i] = i;
	}

	for(int i = 1; i < n; i++)
	{
		vector<int> ok;

		for(int a = 1; a <= n; a++)
		{
			int esq[N], dir[N], id = 0;

			esq[0] = a;

			for(int b = 1; b <= n; b++)
			{
				if(Find(a) != Find(b))
				{
					dir[id] = b;

					id ++;
				}
			}

			if(query(1, id, esq, dir) > 0)
			{
				ok.push_back(a);
			}
		}

		join(ok[0], ok[1]);


		//cout<<i<<" "<<ok.size()<<" "<<" ROAD "<<ok[0]<<" "<<ok[1]<<"\n";
		setRoad(ok[0], ok[1]);
	}
}

# Verdict Execution time Memory Grader output
1 Correct 17 ms 632 KB Ok! 210 queries used.
2 Correct 16 ms 704 KB Ok! 210 queries used.
# Verdict Execution time Memory Grader output
1 Correct 191 ms 704 KB Ok! 2450 queries used.
2 Correct 200 ms 724 KB Ok! 2450 queries used.
3 Correct 258 ms 724 KB Ok! 2450 queries used.
# Verdict Execution time Memory Grader output
1 Incorrect 492 ms 800 KB Number of queries more than 4500 out of 2250
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 470 ms 848 KB Number of queries more than 4000 out of 2000
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 331 ms 848 KB Number of queries more than 3550 out of 1775
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 367 ms 860 KB Number of queries more than 3250 out of 1625
2 Halted 0 ms 0 KB -