Submission #49162

# Submission time Handle Problem Language Result Execution time Memory
49162 2018-05-22T22:43:09 Z StainFizzy Simurgh (IOI17_simurgh) C++14
0 / 100
46 ms 568 KB
#include "simurgh.h"
#include <bits/stdc++.h>
#define N 55
#define f first
#define s second
using namespace std;
typedef pair<int, int> pii;

int ok[N], mm, nn;

vector<pii> grafo[N];

vector<int> roads;

void dfs(int x)
{
	ok[x] = 1;

	random_shuffle(grafo[x].begin(), grafo[x].end());

	for(auto v: grafo[x])
	{
		if(ok[v.f]) continue;

		roads.push_back(v.s);

		dfs(v.f);
	}
}

std::vector<int> find_roads(int n_, std::vector<int> u, std::vector<int> v)
{
	for(int i = 0; i < u.size(); i++)
	{
		grafo[u[i]].push_back({v[i], i});

		grafo[v[i]].push_back({u[i], i});
	}

	while(true)
	{
		memset(ok, 0, sizeof ok);

		roads.clear();

		dfs(1);

		if(count_common_roads(roads) == n_ -1)
		{
			//cout<<"REPOSTA\n";
			//for(auto x: roads) cout<<x<<"\n";
				return roads;
		}
	}
}

Compilation message

simurgh.cpp: In function 'std::vector<int> find_roads(int, std::vector<int>, std::vector<int>)':
simurgh.cpp:33:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int i = 0; i < u.size(); i++)
                 ~~^~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 45 ms 380 KB WA in grader: NO
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 45 ms 380 KB WA in grader: NO
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 45 ms 380 KB WA in grader: NO
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 380 KB correct
2 Incorrect 46 ms 568 KB WA in grader: NO
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 45 ms 380 KB WA in grader: NO
2 Halted 0 ms 0 KB -