Submission #821747

# Submission time Handle Problem Language Result Execution time Memory
821747 2023-08-11T15:14:02 Z vjudge1 Simurgh (IOI17_simurgh) C++17
0 / 100
2 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 && ans.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);
    vector<int>v1;
    v1 = ans;
    sort(v1.begin(),v1.end());
    return v1;
}

Compilation message

simurgh.cpp: In function 'void dfs(int)':
simurgh.cpp:20:17: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   20 |     if(d.size() == (nn - 1))
      |        ~~~~~~~~~^~~~~~~~~~~
simurgh.cpp: In function 'std::vector<int> find_roads(int, std::vector<int>, std::vector<int>)':
simurgh.cpp:30:9: warning: unused variable 'q' [-Wunused-variable]
   30 |     int q , i , j , m , z ,s = 0 , f , l , r , k , x , y , mn  = 1e9 , mx = 0;
      |         ^
simurgh.cpp:30:17: warning: unused variable 'j' [-Wunused-variable]
   30 |     int q , i , j , m , z ,s = 0 , f , l , r , k , x , y , mn  = 1e9 , mx = 0;
      |                 ^
simurgh.cpp:30:25: warning: unused variable 'z' [-Wunused-variable]
   30 |     int q , i , j , m , z ,s = 0 , f , l , r , k , x , y , mn  = 1e9 , mx = 0;
      |                         ^
simurgh.cpp:30:28: warning: unused variable 's' [-Wunused-variable]
   30 |     int q , i , j , m , z ,s = 0 , f , l , r , k , x , y , mn  = 1e9 , mx = 0;
      |                            ^
simurgh.cpp:30:36: warning: unused variable 'f' [-Wunused-variable]
   30 |     int q , i , j , m , z ,s = 0 , f , l , r , k , x , y , mn  = 1e9 , mx = 0;
      |                                    ^
simurgh.cpp:30:40: warning: unused variable 'l' [-Wunused-variable]
   30 |     int q , i , j , m , z ,s = 0 , f , l , r , k , x , y , mn  = 1e9 , mx = 0;
      |                                        ^
simurgh.cpp:30:44: warning: unused variable 'r' [-Wunused-variable]
   30 |     int q , i , j , m , z ,s = 0 , f , l , r , k , x , y , mn  = 1e9 , mx = 0;
      |                                            ^
simurgh.cpp:30:48: warning: unused variable 'k' [-Wunused-variable]
   30 |     int q , i , j , m , z ,s = 0 , f , l , r , k , x , y , mn  = 1e9 , mx = 0;
      |                                                ^
simurgh.cpp:30:52: warning: unused variable 'x' [-Wunused-variable]
   30 |     int q , i , j , m , z ,s = 0 , f , l , r , k , x , y , mn  = 1e9 , mx = 0;
      |                                                    ^
simurgh.cpp:30:56: warning: unused variable 'y' [-Wunused-variable]
   30 |     int q , i , j , m , z ,s = 0 , f , l , r , k , x , y , mn  = 1e9 , mx = 0;
      |                                                        ^
simurgh.cpp:30:60: warning: unused variable 'mn' [-Wunused-variable]
   30 |     int q , i , j , m , z ,s = 0 , f , l , r , k , x , y , mn  = 1e9 , mx = 0;
      |                                                            ^~
simurgh.cpp:30:72: warning: unused variable 'mx' [-Wunused-variable]
   30 |     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 Correct 0 ms 212 KB correct
2 Incorrect 2 ms 212 KB WA in grader: NO
3 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 -