Submission #821269

# Submission time Handle Problem Language Result Execution time Memory
821269 2023-08-11T08:35:33 Z vjudge1 Simurgh (IOI17_simurgh) C++17
Compilation error
0 ms 0 KB
#include "simurgh.h"
#include <bits/stdc++.h>

using namespace std;

const int N = 100;
int us[N] , nn ;

vector<int>ans;
vector<pair<int,int>>vc[N];
deque<int>d;


void dfs(int n){
    us[n] = 1;
    for(auto to : vc[n]){
        if(!us[to.first] && ans.size() == 0)
            d.push_back(to.second) , dfs(to.first);
    }
  //  cout<<nn<<" "<<n<<" "<<d.size()<<"\n";
    if(d.size() == (nn - 1)){
        if(count_common_roads(d) == nn - 1){
            for(auto to : d)
                ans.push_back(to);
        }
    }
    if(d.size())
    d.pop_back();
    us[n] = 0;
}

vector<int> find_roads(int n , vector<int>u , vector<int>v){
    int q , i , j , m , z ,s = 0 , f , l , r , k , x , y , mn  = 1e9 , mx = 0;
    m = u.size();
    nn = n;
    for(i = 0; i < m; i++){
        vc[u[i]].push_back({v[i] , i});
        vc[v[i]].push_back({u[i] , i});
    }
    for(i = 0;i < n; i++)
    dfs(i);
    return ans;
}


/*
void solve(){
    int q , i , j , m ,n, z ,s = 0 , f , l , r , k , x , y , mn  = 1e18 , mx = 0;
    vector<int>u  = find_roads(4, {0, 0, 0, 1, 1, 2}, {1, 2, 3, 2, 3, 3});
    //cout<<u.size()<<"\n";
    for(auto to : u)
        cout<<to<<"\n";
}

int main(){

/*     #ifndef ONLINE_JUDGE
     freopen("input.txt", "r", stdin);
     freopen("output.txt", "w", stdout);
     #endif
     */
/*int t = 1;
//cin>>t;

while(t--)
     {
     solve();
     }

}
// Author : حسن
*/

Compilation message

simurgh.cpp:58:1: warning: "/*" within comment [-Wcomment]
   58 | /*     #ifndef ONLINE_JUDGE
      |  
simurgh.cpp: In function 'void dfs(int)':
simurgh.cpp:22:17: warning: comparison of integer expressions of different signedness: 'std::deque<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   22 |     if(d.size() == (nn - 1)){
      |        ~~~~~~~~~^~~~~~~~~~~
simurgh.cpp:23:31: error: invalid initialization of reference of type 'const std::vector<int>&' from expression of type 'std::deque<int>'
   23 |         if(count_common_roads(d) == nn - 1){
      |                               ^
In file included from simurgh.cpp:2:
simurgh.h:4:48: note: in passing argument 1 of 'int count_common_roads(const std::vector<int>&)'
    4 | int count_common_roads(const std::vector<int>& r);
      |                        ~~~~~~~~~~~~~~~~~~~~~~~~^
simurgh.cpp: In function 'std::vector<int> find_roads(int, std::vector<int>, std::vector<int>)':
simurgh.cpp:34:9: warning: unused variable 'q' [-Wunused-variable]
   34 |     int q , i , j , m , z ,s = 0 , f , l , r , k , x , y , mn  = 1e9 , mx = 0;
      |         ^
simurgh.cpp:34:17: warning: unused variable 'j' [-Wunused-variable]
   34 |     int q , i , j , m , z ,s = 0 , f , l , r , k , x , y , mn  = 1e9 , mx = 0;
      |                 ^
simurgh.cpp:34:25: warning: unused variable 'z' [-Wunused-variable]
   34 |     int q , i , j , m , z ,s = 0 , f , l , r , k , x , y , mn  = 1e9 , mx = 0;
      |                         ^
simurgh.cpp:34:28: warning: unused variable 's' [-Wunused-variable]
   34 |     int q , i , j , m , z ,s = 0 , f , l , r , k , x , y , mn  = 1e9 , mx = 0;
      |                            ^
simurgh.cpp:34:36: warning: unused variable 'f' [-Wunused-variable]
   34 |     int q , i , j , m , z ,s = 0 , f , l , r , k , x , y , mn  = 1e9 , mx = 0;
      |                                    ^
simurgh.cpp:34:40: warning: unused variable 'l' [-Wunused-variable]
   34 |     int q , i , j , m , z ,s = 0 , f , l , r , k , x , y , mn  = 1e9 , mx = 0;
      |                                        ^
simurgh.cpp:34:44: warning: unused variable 'r' [-Wunused-variable]
   34 |     int q , i , j , m , z ,s = 0 , f , l , r , k , x , y , mn  = 1e9 , mx = 0;
      |                                            ^
simurgh.cpp:34:48: warning: unused variable 'k' [-Wunused-variable]
   34 |     int q , i , j , m , z ,s = 0 , f , l , r , k , x , y , mn  = 1e9 , mx = 0;
      |                                                ^
simurgh.cpp:34:52: warning: unused variable 'x' [-Wunused-variable]
   34 |     int q , i , j , m , z ,s = 0 , f , l , r , k , x , y , mn  = 1e9 , mx = 0;
      |                                                    ^
simurgh.cpp:34:56: warning: unused variable 'y' [-Wunused-variable]
   34 |     int q , i , j , m , z ,s = 0 , f , l , r , k , x , y , mn  = 1e9 , mx = 0;
      |                                                        ^
simurgh.cpp:34:60: warning: unused variable 'mn' [-Wunused-variable]
   34 |     int q , i , j , m , z ,s = 0 , f , l , r , k , x , y , mn  = 1e9 , mx = 0;
      |                                                            ^~
simurgh.cpp:34:72: warning: unused variable 'mx' [-Wunused-variable]
   34 |     int q , i , j , m , z ,s = 0 , f , l , r , k , x , y , mn  = 1e9 , mx = 0;
      |                                                                        ^~