Submission #821279

# Submission time Handle Problem Language Result Execution time Memory
821279 2023-08-11T08:39:12 Z vjudge1 Simurgh (IOI17_simurgh) C++17
0 / 100
1 ms 212 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];
vector<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 && d.size() == 0){
            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;
}


Compilation message

simurgh.cpp: In function 'void dfs(int)':
simurgh.cpp:22:17: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   22 |     if(d.size() == (nn - 1)){
      |        ~~~~~~~~~^~~~~~~~~~~
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;
      |                                                                        ^~
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB WA in grader: NO
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB WA in grader: NO
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB WA in grader: NO
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB WA in grader: NO
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB WA in grader: NO
2 Halted 0 ms 0 KB -