Submission #33816

#TimeUsernameProblemLanguageResultExecution timeMemory
33816mohammad_kilaniSimurgh (IOI17_simurgh)C++14
13 / 100
76 ms2024 KiB
#include "simurgh.h" #include <bits/stdc++.h> using namespace std; const int N =12; vector<int> r , ans , u , v; int n , m; vector< int > g[N]; int cur = 0 , vis[N] , vi = 0 ; void DFS(int node){ vis[node] = vi; cur++; for(int i=0;i<g[node].size();i++){ if(vis[g[node][i]] != vi) DFS(g[node][i]); } } void calc(int i){ if(r.size() >= n) return; if(i == m){ if(r.size() < n - 1) return; for(int i=0;i<n;i++){ g[i].clear(); } for(int i=0;i<r.size();i++){ g[u[r[i]]].push_back(v[r[i]]); g[v[r[i]]].push_back(u[r[i]]); } cur = 0; vi++; DFS(0); if(cur != n) return; if(count_common_roads(r) == n-1){ ans = r; } return ; } r.push_back(i); calc(i+1); r.pop_back(); calc(i+1); } std::vector<int> find_roads(int N, std::vector<int> U, std::vector<int> V) { u = U; v = V; n = N; m = u.size(); r.clear(); calc(0); return ans; }

Compilation message (stderr)

simurgh.cpp: In function 'void DFS(int)':
simurgh.cpp:12:15: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int i=0;i<g[node].size();i++){
               ^
simurgh.cpp: In function 'void calc(int)':
simurgh.cpp:18:14: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  if(r.size() >= n) return;
              ^
simurgh.cpp:20:15: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   if(r.size() < n - 1) return;
               ^
simurgh.cpp:24:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for(int i=0;i<r.size();i++){
                ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...