Submission #91177

# Submission time Handle Problem Language Result Execution time Memory
91177 2018-12-26T12:57:55 Z mirbek01 Tropical Garden (IOI11_garden) C++11
0 / 100
22 ms 3036 KB
#include "garden.h"
#include "gardenlib.h"

# include <bits/stdc++.h>

using namespace std;

const int MN = 1e5 + 2;

int vr, k, pt[MN];
bool fl;
vector <int> g[MN];

void dfs(int v, int d){
      if(fl)
            return ;
      if(d == k){
            vr = v;
            fl = 1;
            return ;
      }
      for(; pt[v] < (int)g[v].size();){
            int to = g[v][pt[v] ++];
            dfs(to, d + 1);
      }
}

void count_routes(int n, int m, int p, int R[][2], int q, int G[]){
      for(int i = 0; i < m; i ++){
           int u = R[i][0], v = R[i][1];
           g[u].push_back(v);
           g[v].push_back(u);
      }

      for(int i = 0; i < q; i ++){
            k = G[i];
            int ret = 0;
            for(int j = 0; j < n; j ++){
                  fl = 0;
                  vr = -1;
                  memset(pt, 0, sizeof(pt));
                  dfs(j, 0);
                  if(vr == p){
                        ret ++;
                  }
            }
            answer(ret);
      }
}

# Verdict Execution time Memory Grader output
1 Incorrect 22 ms 3036 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 22 ms 3036 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 22 ms 3036 KB Output isn't correct
2 Halted 0 ms 0 KB -