Submission #426859

# Submission time Handle Problem Language Result Execution time Memory
426859 2021-06-14T10:31:47 Z MOUF_MAHMALAT Simurgh (IOI17_simurgh) C++14
0 / 100
5 ms 204 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;
    }
    for(auto z:v[d])
    {
        if(b[z.F]==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);
    return op;
}

Compilation message

simurgh.cpp: In function 'std::vector<int> find_roads(int, std::vector<int>, std::vector<int>)':
simurgh.cpp:38:18: warning: comparison of integer expressions of different signedness: 'll' {aka 'int'} and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   38 |     for(ll i=0; i<u1.size(); i++)
      |                 ~^~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB WA in grader: NO
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB WA in grader: NO
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB WA in grader: NO
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB correct
2 Incorrect 5 ms 204 KB WA in grader: NO
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB WA in grader: NO
2 Halted 0 ms 0 KB -