답안 #424564

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
424564 2021-06-12T06:09:35 Z Pyqe Simurgh (IOI17_simurgh) C++14
13 / 100
3000 ms 300 KB
#include <bits/stdc++.h>
#include "simurgh.h"

using namespace std;

#define mp make_pair
#define fr first
#define sc second

long long m,dsu[569];
pair<long long,long long> ed[569];

long long fd(long long x)
{
	if(dsu[x]!=x)
	{
		dsu[x]=fd(dsu[x]);
	}
	return dsu[x];
}

vector<int> find_roads(int n,vector<int> ka,vector<int> la)
{
	long long i,k,l,mk;
	vector<int> v;
	
	m=ka.size();
	for(mk=0;mk<1ll<<m;mk++)
	{
		for(i=1;i<=n;i++)
		{
			dsu[i]=i;
		}
		v.clear();
		for(i=0;i<m;i++)
		{
			if(mk>>i&1)
			{
				k=ka[i]+1;
				l=la[i]+1;
				if(fd(k)==fd(l))
				{
					break;
				}
				dsu[fd(l)]=fd(k);
				v.push_back(i);
			}
		}
		if(i>=m&&v.size()==n-1&&count_common_roads(v)==n-1)
		{
			return v;
		}
	}
}

Compilation message

simurgh.cpp: In function 'std::vector<int> find_roads(int, std::vector<int>, std::vector<int>)':
simurgh.cpp:49:20: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   49 |   if(i>=m&&v.size()==n-1&&count_common_roads(v)==n-1)
      |            ~~~~~~~~^~~~~
simurgh.cpp:54:1: warning: control reaches end of non-void function [-Wreturn-type]
   54 | }
      | ^
# 결과 실행 시간 메모리 Grader output
1 Correct 16 ms 204 KB correct
2 Correct 153 ms 288 KB correct
3 Correct 177 ms 296 KB correct
4 Correct 1 ms 300 KB correct
5 Correct 0 ms 204 KB correct
6 Correct 4 ms 204 KB correct
7 Correct 1 ms 204 KB correct
8 Correct 1 ms 204 KB correct
9 Correct 1 ms 204 KB correct
10 Correct 2 ms 204 KB correct
11 Correct 1 ms 204 KB correct
12 Correct 2 ms 204 KB correct
13 Correct 49 ms 204 KB correct
# 결과 실행 시간 메모리 Grader output
1 Correct 16 ms 204 KB correct
2 Correct 153 ms 288 KB correct
3 Correct 177 ms 296 KB correct
4 Correct 1 ms 300 KB correct
5 Correct 0 ms 204 KB correct
6 Correct 4 ms 204 KB correct
7 Correct 1 ms 204 KB correct
8 Correct 1 ms 204 KB correct
9 Correct 1 ms 204 KB correct
10 Correct 2 ms 204 KB correct
11 Correct 1 ms 204 KB correct
12 Correct 2 ms 204 KB correct
13 Correct 49 ms 204 KB correct
14 Execution timed out 3090 ms 204 KB Time limit exceeded
15 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 16 ms 204 KB correct
2 Correct 153 ms 288 KB correct
3 Correct 177 ms 296 KB correct
4 Correct 1 ms 300 KB correct
5 Correct 0 ms 204 KB correct
6 Correct 4 ms 204 KB correct
7 Correct 1 ms 204 KB correct
8 Correct 1 ms 204 KB correct
9 Correct 1 ms 204 KB correct
10 Correct 2 ms 204 KB correct
11 Correct 1 ms 204 KB correct
12 Correct 2 ms 204 KB correct
13 Correct 49 ms 204 KB correct
14 Execution timed out 3090 ms 204 KB Time limit exceeded
15 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB correct
2 Incorrect 59 ms 204 KB WA in grader: NO
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 16 ms 204 KB correct
2 Correct 153 ms 288 KB correct
3 Correct 177 ms 296 KB correct
4 Correct 1 ms 300 KB correct
5 Correct 0 ms 204 KB correct
6 Correct 4 ms 204 KB correct
7 Correct 1 ms 204 KB correct
8 Correct 1 ms 204 KB correct
9 Correct 1 ms 204 KB correct
10 Correct 2 ms 204 KB correct
11 Correct 1 ms 204 KB correct
12 Correct 2 ms 204 KB correct
13 Correct 49 ms 204 KB correct
14 Execution timed out 3090 ms 204 KB Time limit exceeded
15 Halted 0 ms 0 KB -