답안 #132168

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
132168 2019-07-18T11:38:38 Z mlyean00 열대 식물원 (Tropical Garden) (IOI11_garden) C++14
49 / 100
5000 ms 1788 KB
#include "garden.h"
#include "gardenlib.h"

#include <bits/stdc++.h>

using namespace std;
using adj_list = vector<vector<int>>;

adj_list g;

int dfs(int u, int p, int left) {
    if (left == 0) return u;
    if (g[u][0] == p && g[u].size() > 1)
        return dfs(g[u][1], u, left - 1);
    else
        return dfs(g[u][0], u, left - 1);
}

void count_routes(int N, int M, int P, int R[][2], int Q, int G[]) {
    g = adj_list(N);
    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]);
    }

    for (int q = 0; q < Q; ++q) {
        int ans = 0;
        for (int i = 0; i < N; ++i) {
            if (dfs(i, i, G[q]) == P) ++ans;
        }
        answer(ans);
    }
}
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 376 KB Output is correct
2 Correct 3 ms 376 KB Output is correct
3 Correct 3 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 3 ms 504 KB Output is correct
7 Correct 2 ms 348 KB Output is correct
8 Correct 3 ms 376 KB Output is correct
9 Correct 5 ms 504 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 376 KB Output is correct
2 Correct 3 ms 376 KB Output is correct
3 Correct 3 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 3 ms 504 KB Output is correct
7 Correct 2 ms 348 KB Output is correct
8 Correct 3 ms 376 KB Output is correct
9 Correct 5 ms 504 KB Output is correct
10 Correct 7 ms 380 KB Output is correct
11 Execution timed out 5047 ms 1788 KB Time limit exceeded
12 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 376 KB Output is correct
2 Correct 3 ms 376 KB Output is correct
3 Correct 3 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 3 ms 504 KB Output is correct
7 Correct 2 ms 348 KB Output is correct
8 Correct 3 ms 376 KB Output is correct
9 Correct 5 ms 504 KB Output is correct
10 Correct 7 ms 380 KB Output is correct
11 Execution timed out 5047 ms 1788 KB Time limit exceeded
12 Halted 0 ms 0 KB -