답안 #1105212

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1105212 2024-10-25T17:51:40 Z jadai007 열대 식물원 (Tropical Garden) (IOI11_garden) C++17
49 / 100
5000 ms 7292 KB
#include "garden.h"
#include "gardenlib.h"
#include <bits/stdc++.h>

using namespace std;

int ans = 0;
vector<int> vc[200200];

void dfs(int u, int k, int P, int par){
    if(k == 0){
        if(u == P) ans++;
        return;
    }
    if(vc[u].size() == 1) dfs(vc[u][0], k - 1, P, u);
    else{
        for(auto v:vc[u]){
            if(v == par) continue;
            dfs(v, k - 1, P, u);
            break;
        }
    }
}

void count_routes(int N, int M, int P, int R[][2], int Q, int G[]){
    for(int i = 0; i < M; ++i) vc[R[i][0]].emplace_back(R[i][1]), vc[R[i][1]].emplace_back(R[i][0]);
    for(int i = 0; i < N; ++i) dfs(i, G[0], P, -1);
    answer(ans);
}


# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 6736 KB Output is correct
2 Correct 3 ms 6736 KB Output is correct
3 Correct 3 ms 6784 KB Output is correct
4 Correct 2 ms 6736 KB Output is correct
5 Correct 2 ms 6736 KB Output is correct
6 Correct 3 ms 6736 KB Output is correct
7 Correct 2 ms 6736 KB Output is correct
8 Correct 2 ms 6736 KB Output is correct
9 Correct 3 ms 6736 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 6736 KB Output is correct
2 Correct 3 ms 6736 KB Output is correct
3 Correct 3 ms 6784 KB Output is correct
4 Correct 2 ms 6736 KB Output is correct
5 Correct 2 ms 6736 KB Output is correct
6 Correct 3 ms 6736 KB Output is correct
7 Correct 2 ms 6736 KB Output is correct
8 Correct 2 ms 6736 KB Output is correct
9 Correct 3 ms 6736 KB Output is correct
10 Correct 6 ms 6736 KB Output is correct
11 Execution timed out 5084 ms 7292 KB Time limit exceeded
12 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 6736 KB Output is correct
2 Correct 3 ms 6736 KB Output is correct
3 Correct 3 ms 6784 KB Output is correct
4 Correct 2 ms 6736 KB Output is correct
5 Correct 2 ms 6736 KB Output is correct
6 Correct 3 ms 6736 KB Output is correct
7 Correct 2 ms 6736 KB Output is correct
8 Correct 2 ms 6736 KB Output is correct
9 Correct 3 ms 6736 KB Output is correct
10 Correct 6 ms 6736 KB Output is correct
11 Execution timed out 5084 ms 7292 KB Time limit exceeded
12 Halted 0 ms 0 KB -