답안 #765999

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
765999 2023-06-25T08:36:07 Z NeroZein 열대 식물원 (Tropical Garden) (IOI11_garden) C++17
49 / 100
5000 ms 4872 KB
#include "garden.h"
#include "gardenlib.h"
#include "bits/stdc++.h"
using namespace std; 

const int MX = 150005;

int k;
int PP;
int ans;
stack<int> stk;
int vis[MX][2]; 
vector<int> g[MX];

void Dfs (int v, int p, int t) {
  //cout << v << ' '; 
  if (t == k && v == PP) {
    ans++;
    //cout << "GG"; 
    return; 
  }
  if (t > k) return; 
  int nx = (g[v].size() == 1 ? 0 : (p == g[v][0]));
  Dfs(g[v][nx], v, t + 1); 
}

void count_routes(int N, int M, int P, int R[][2], int Q, int G[]) {
  PP = P;   
  for (int i = 0; i < M; ++i) {
    g[R[i][0]].push_back(R[i][1]);
    g[R[i][1]].push_back(R[i][0]);
  }
  k = G[0];
  for (int i = 0; i < N; ++i) {
    Dfs(i, -1, 0); 
    //cout << '\n';
  }
  answer(ans); 
}


# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 3844 KB Output is correct
2 Correct 3 ms 3796 KB Output is correct
3 Correct 3 ms 3844 KB Output is correct
4 Correct 2 ms 3840 KB Output is correct
5 Correct 2 ms 3796 KB Output is correct
6 Correct 3 ms 3848 KB Output is correct
7 Correct 2 ms 3796 KB Output is correct
8 Correct 3 ms 3796 KB Output is correct
9 Correct 4 ms 4052 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 3844 KB Output is correct
2 Correct 3 ms 3796 KB Output is correct
3 Correct 3 ms 3844 KB Output is correct
4 Correct 2 ms 3840 KB Output is correct
5 Correct 2 ms 3796 KB Output is correct
6 Correct 3 ms 3848 KB Output is correct
7 Correct 2 ms 3796 KB Output is correct
8 Correct 3 ms 3796 KB Output is correct
9 Correct 4 ms 4052 KB Output is correct
10 Correct 8 ms 3840 KB Output is correct
11 Execution timed out 5076 ms 4872 KB Time limit exceeded
12 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 3844 KB Output is correct
2 Correct 3 ms 3796 KB Output is correct
3 Correct 3 ms 3844 KB Output is correct
4 Correct 2 ms 3840 KB Output is correct
5 Correct 2 ms 3796 KB Output is correct
6 Correct 3 ms 3848 KB Output is correct
7 Correct 2 ms 3796 KB Output is correct
8 Correct 3 ms 3796 KB Output is correct
9 Correct 4 ms 4052 KB Output is correct
10 Correct 8 ms 3840 KB Output is correct
11 Execution timed out 5076 ms 4872 KB Time limit exceeded
12 Halted 0 ms 0 KB -