Submission #507635

# Submission time Handle Problem Language Result Execution time Memory
507635 2022-01-12T21:25:32 Z Hanksburger Simurgh (IOI17_simurgh) C++17
13 / 100
42 ms 428 KB
#include "simurgh.h"
#include <bits/stdc++.h>
using namespace std;
vector<pair<int, int> > adj[10];
vector<int> UU, VV, ans;
bool visited[10];
queue<int> Q;
int NN;
bool recur(int X, int Y)
{
	if (X==NN-1)
	{
		for (int i=0; i<NN; i++)
			visited[i]=0;
		visited[0]=1;
		Q.push(0);
		while (!Q.empty())
		{
			int U=Q.front();
			Q.pop();
			for (int i=0; i<adj[U].size(); i++)
			{
				int V=adj[U][i].first;
				if (!visited[V])
				{
					visited[V]=1;
					Q.push(V);
				}
			}
		}
		for (int i=0; i<NN; i++)
			if (!visited[i])
				return 0;
		if (count_common_roads(ans)==NN-1)
			return 1;
		else
			return 0;
	}
	for (int i=Y; i<UU.size(); i++)
	{
		adj[UU[i]].push_back({VV[i], i});
		adj[VV[i]].push_back({UU[i], i});
		ans.push_back(i);
		if (recur(X+1, i+1))
			return 1;
		adj[UU[i]].pop_back();
		adj[VV[i]].pop_back();
		ans.pop_back();
	}
	return 0;
}
vector<int> find_roads(int N, vector<int> U, vector<int> V)
{
	if (N<=7)
	{
		NN=N;
		UU=U;
		VV=V;
		recur(0, 0);
		return ans;
	}
}

Compilation message

simurgh.cpp: In function 'bool recur(int, int)':
simurgh.cpp:21:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   21 |    for (int i=0; i<adj[U].size(); i++)
      |                  ~^~~~~~~~~~~~~~
simurgh.cpp:39:17: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   39 |  for (int i=Y; i<UU.size(); i++)
      |                ~^~~~~~~~~~
simurgh.cpp: In function 'std::vector<int> find_roads(int, std::vector<int>, std::vector<int>)':
simurgh.cpp:62:1: warning: control reaches end of non-void function [-Wreturn-type]
   62 | }
      | ^
# Verdict Execution time Memory Grader output
1 Correct 8 ms 204 KB correct
2 Correct 2 ms 204 KB correct
3 Correct 6 ms 204 KB correct
4 Correct 0 ms 204 KB correct
5 Correct 0 ms 288 KB correct
6 Correct 1 ms 204 KB correct
7 Correct 0 ms 204 KB correct
8 Correct 0 ms 204 KB correct
9 Correct 0 ms 204 KB correct
10 Correct 1 ms 204 KB correct
11 Correct 0 ms 204 KB correct
12 Correct 1 ms 288 KB correct
13 Correct 6 ms 244 KB correct
# Verdict Execution time Memory Grader output
1 Correct 8 ms 204 KB correct
2 Correct 2 ms 204 KB correct
3 Correct 6 ms 204 KB correct
4 Correct 0 ms 204 KB correct
5 Correct 0 ms 288 KB correct
6 Correct 1 ms 204 KB correct
7 Correct 0 ms 204 KB correct
8 Correct 0 ms 204 KB correct
9 Correct 0 ms 204 KB correct
10 Correct 1 ms 204 KB correct
11 Correct 0 ms 204 KB correct
12 Correct 1 ms 288 KB correct
13 Correct 6 ms 244 KB correct
14 Runtime error 1 ms 428 KB Execution killed with signal 11
15 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 8 ms 204 KB correct
2 Correct 2 ms 204 KB correct
3 Correct 6 ms 204 KB correct
4 Correct 0 ms 204 KB correct
5 Correct 0 ms 288 KB correct
6 Correct 1 ms 204 KB correct
7 Correct 0 ms 204 KB correct
8 Correct 0 ms 204 KB correct
9 Correct 0 ms 204 KB correct
10 Correct 1 ms 204 KB correct
11 Correct 0 ms 204 KB correct
12 Correct 1 ms 288 KB correct
13 Correct 6 ms 244 KB correct
14 Runtime error 1 ms 428 KB Execution killed with signal 11
15 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB correct
2 Incorrect 42 ms 204 KB WA in grader: NO
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 8 ms 204 KB correct
2 Correct 2 ms 204 KB correct
3 Correct 6 ms 204 KB correct
4 Correct 0 ms 204 KB correct
5 Correct 0 ms 288 KB correct
6 Correct 1 ms 204 KB correct
7 Correct 0 ms 204 KB correct
8 Correct 0 ms 204 KB correct
9 Correct 0 ms 204 KB correct
10 Correct 1 ms 204 KB correct
11 Correct 0 ms 204 KB correct
12 Correct 1 ms 288 KB correct
13 Correct 6 ms 244 KB correct
14 Runtime error 1 ms 428 KB Execution killed with signal 11
15 Halted 0 ms 0 KB -