답안 #426839

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
426839 2021-06-14T10:23:08 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)
    {
        ll ans=count_common_roads(op);
        if(ans==n)
        {
            is=1;
            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,1);
}

Compilation message

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