Submission #426852

# Submission time Handle Problem Language Result Execution time Memory
426852 2021-06-14T10:29:16 Z MOUF_MAHMALAT Simurgh (IOI17_simurgh) C++14
0 / 100
1 ms 332 KB
#include "simurgh.h"
#include<bits/stdc++.h>
#define F first
#define S second
using namespace std;
typedef int ll;
deque<deque<pair<ll,ll> > >v;
vector<ll>op;
ll n;
bool b[509],is;
void dfs(ll d,ll cnt)
{
    b[d]=1;
    if(cnt==n-1)
    {
        ll ans=count_common_roads(op);
        if(ans==n-1)
        {
            is=1;
            return;
        }
        return;
    }
    for(auto z:v[d])
    {
        if(b[d]==0)
        {
            op.push_back(z.S);
            dfs(z.F,cnt+1);
            if(is)
                return;
            op.pop_back();
        }
    }
    b[d]=0;
}
vector<int> find_roads(int N, vector<int> u1, vector<int> u2)
{
    n=N;
    v.resize(n);
    for(ll i=0; i<u1.size(); i++)
    {
        v[u1[i]].push_back({u2[i],i});
        v[u2[i]].push_back({u1[i],i});
    }
    dfs(0,0);
}

Compilation message

simurgh.cpp: In function 'std::vector<int> find_roads(int, std::vector<int>, std::vector<int>)':
simurgh.cpp:41:18: warning: comparison of integer expressions of different signedness: 'll' {aka 'int'} and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   41 |     for(ll i=0; i<u1.size(); i++)
      |                 ~^~~~~~~~~~
simurgh.cpp:47:1: warning: no return statement in function returning non-void [-Wreturn-type]
   47 | }
      | ^
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 332 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 332 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 332 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 332 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 332 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -