Submission #85649

# Submission time Handle Problem Language Result Execution time Memory
85649 2018-11-21T09:50:08 Z mirbek01 Tropical Garden (IOI11_garden) C++17
0 / 100
3 ms 376 KB
#include "garden.h"
#include "gardenlib.h"
#include <bits/stdc++.h>

using namespace std;

const int MAXN = 1e3 + 2;

int k, ans, p, cnt[MAXN], used[MAXN];
vector <int> g[MAXN];

bool dfs(int v){
      int c = k;
      int pr = v;
      while(c --){
            if(g[v][0] == pr && g[v].size() > 1){
                  pr = v;
                  v = g[v][1];
            } else {
                  pr = v;
                  v = g[v][0];
            }
      }
      return v == p;
}

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];
            if(g[u].size() < 2)
            g[u].push_back(v);
            if(g[v].size() < 2)
            g[v].push_back(u);
      }
      p = P;
      for(int i = 0; i < Q; i ++){
            k = G[i];
            ans = 0;
            for(int i = 1; i < N; i ++){
                  memset(cnt, 0, sizeof(cnt));
                  memset(used, 0, sizeof(used));
                  ans += dfs(i);
            }
            answer(ans);
      }
}
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -