| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 426942 | MOUF_MAHMALAT | Simurgh (IOI17_simurgh) | C++14 | 16 ms | 296 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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 (stderr)
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
