답안 #60637

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
60637 2018-07-24T12:34:58 Z theknife2001 열대 식물원 (Tropical Garden) (IOI11_garden) C++17
49 / 100
12 ms 1392 KB
#include "garden.h"
#include "gardenlib.h"
#include <bits/stdc++.h>


using namespace std;
const int N=1005;
vector < pair < int , int > > vec[N];

int dfs(int u , int p , int k)
{
    if(!k)
        return u;
    int v,c;
    int mv=p,mc=0;
    for(auto x:vec[u])
    {
        v=x.first;
        c=x.second;
        if(v==p)
            continue;
        if(c>mc)
        {
            mc=c;
            mv=v;
        }
    }
    return dfs(mv,u,k-1);
}

void count_routes(int n, int m, int P, int r[][2], int Q, int G[])
{
    int k=G[0];
    for(int i=0;i<m;i++)
    {
        vec[r[i][0]].push_back({r[i][1],m-i});
        vec[r[i][1]].push_back({r[i][0],m-i});
    }
    int cnt=0;
    for(int i=0;i<n;i++)
    {
        if(dfs(i,-1,k)==P)
            cnt++;
    }
    answer(cnt);
}


# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 376 KB Output is correct
2 Correct 3 ms 380 KB Output is correct
3 Correct 3 ms 376 KB Output is correct
4 Correct 2 ms 348 KB Output is correct
5 Correct 2 ms 348 KB Output is correct
6 Correct 4 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 7 ms 656 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 376 KB Output is correct
2 Correct 3 ms 380 KB Output is correct
3 Correct 3 ms 376 KB Output is correct
4 Correct 2 ms 348 KB Output is correct
5 Correct 2 ms 348 KB Output is correct
6 Correct 4 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 7 ms 656 KB Output is correct
10 Correct 9 ms 424 KB Output is correct
11 Runtime error 12 ms 1392 KB Execution killed with signal 11 (could be triggered by violating memory limits)
12 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 376 KB Output is correct
2 Correct 3 ms 380 KB Output is correct
3 Correct 3 ms 376 KB Output is correct
4 Correct 2 ms 348 KB Output is correct
5 Correct 2 ms 348 KB Output is correct
6 Correct 4 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 7 ms 656 KB Output is correct
10 Correct 9 ms 424 KB Output is correct
11 Runtime error 12 ms 1392 KB Execution killed with signal 11 (could be triggered by violating memory limits)
12 Halted 0 ms 0 KB -