Submission #68758

# Submission time Handle Problem Language Result Execution time Memory
68758 2018-08-18T10:40:21 Z Talant Simurgh (IOI17_simurgh) C++17
0 / 100
30 ms 23988 KB
#include "simurgh.h"
//#include "grader.cpp"

#include <bits/stdc++.h>

#define sc second
#define fr first
#define mk make_pair
#define pb push_back

using namespace std;

const int N = (1e6 + 5);
const int inf = (1e9 + 7);

vector <pair<int,int> > g[N];
vector <int> vec,ans;

int was[N];
int nn;
int f;

void dfs (int v) {
      if (f) return;
      was[v] = 1;
      for (auto to : g[v]) {
            if (!was[to.fr]) {
                  vec.pb(to.sc);
                  dfs(to.fr);
                  vec.pop_back();
            }
      }
      was[v] = 0;
      if (vec.size() == nn - 1) {
            int o = count_common_roads(vec);
            if (o == nn - 1) {
                  ans = vec;
                  f = 1;
                  return;
            }
      }
}
vector<int> find_roads(int n, vector<int> u, vector<int> v) {
      nn = n;
	for (int i = 0; i < u.size(); i ++) {
            g[u[i]].pb(mk(v[i],i));
            g[v[i]].pb(mk(u[i],i));
	}
	for (int i = 0; i < n; i ++) {
           dfs(i);
           if (f) return ans;
	}
      return ans;
}

Compilation message

simurgh.cpp: In function 'void dfs(int)':
simurgh.cpp:34:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
       if (vec.size() == nn - 1) {
           ~~~~~~~~~~~^~~~~~~~~
simurgh.cpp: In function 'std::vector<int> find_roads(int, std::vector<int>, std::vector<int>)':
simurgh.cpp:45:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for (int i = 0; i < u.size(); i ++) {
                  ~~^~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 27 ms 23800 KB WA in grader: NO
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 27 ms 23800 KB WA in grader: NO
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 27 ms 23800 KB WA in grader: NO
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 23 ms 23908 KB correct
2 Incorrect 30 ms 23988 KB WA in grader: NO
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 27 ms 23800 KB WA in grader: NO
2 Halted 0 ms 0 KB -