#include "simurgh.h"
#include<bits/stdc++.h>
#define F first
#define S second
using namespace std;
typedef int ll;
vector<ll>op,v,w;
ll n,b[509];
bool is;
void best(ll d,ll cnt)
{
if(cnt==n-1)
{
ll ans=count_common_roads(op);
if(ans==n-1)
is=1;
return;
}
if(d==v.size())
return;
best(d+1,cnt);
if(is||min(b[v[d]],b[w[d]]))
return;
b[v[d]]++,b[w[d]]++;
op.push_back(d);
best(d+1,cnt+1);
if(is)
return;
op.pop_back();
b[v[d]]--,b[w[d]]--;
}
vector<int> find_roads(int N, vector<int> u1, vector<int> u2)
{
n=N;
v=u1,w=u2;
best(0,0);
return op;
}
Compilation message
simurgh.cpp: In function 'void best(ll, ll)':
simurgh.cpp:19:9: warning: comparison of integer expressions of different signedness: 'll' {aka 'int'} and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
19 | if(d==v.size())
| ~^~~~~~~~~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
204 KB |
correct |
2 |
Incorrect |
2 ms |
296 KB |
WA in grader: NO |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
204 KB |
correct |
2 |
Incorrect |
2 ms |
296 KB |
WA in grader: NO |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
204 KB |
correct |
2 |
Incorrect |
2 ms |
296 KB |
WA in grader: NO |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
204 KB |
correct |
2 |
Incorrect |
16 ms |
204 KB |
WA in grader: NO |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
204 KB |
correct |
2 |
Incorrect |
2 ms |
296 KB |
WA in grader: NO |
3 |
Halted |
0 ms |
0 KB |
- |