답안 #28848

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
28848 2017-07-17T10:40:11 Z Nikefor 열대 식물원 (Tropical Garden) (IOI11_garden) C++
0 / 100
3 ms 380 KB
#include "garden.h"
#include "gardenlib.h"
#include<bits/stdc++.h>
#define mp make_pair
using namespace std;
int counter = 0;
int tar;
vector< vector<pair<int,int> > > adj;
void DFSVisit(int n, int hak, int road);
void count_routes(int N, int M, int P, int R[][2], int Q, int G[])
{
  //  printf("hebele\n");
    tar = P;
    adj.resize(N);
  //  printf("hebele\n");
    for(int i=0; i<N; i++) {
        int c1 = R[i][0];
        int c2 = R[i][1];
      //  printf("hebele\n");
        adj[c1].push_back(mp(c2,i));
        adj[c2].push_back(mp(c1,i));
    }
   // printf("hebele\n");
    for(int i=0; i<N; i++) DFSVisit(adj[i][0].first, G[0]-1, adj[i][0].second );

        answer(counter);
}
void DFSVisit(int n, int hak, int road) {
  //  printf("%d\n", hak);
    if(hak==0) {
        if (n==tar) counter++;
        return;
    }
    if(adj[n].size()==1) DFSVisit(adj[n][0].first, hak-1, road);
    else if(adj[n][0].second != road) DFSVisit(adj[n][0].first, hak-1, adj[n][0].second);
    else DFSVisit(adj[n][1].first, hak-1, adj[n][1].second);

}

# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 320 KB Output is correct
2 Correct 3 ms 376 KB Output is correct
3 Correct 3 ms 380 KB Output is correct
4 Incorrect 2 ms 376 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 320 KB Output is correct
2 Correct 3 ms 376 KB Output is correct
3 Correct 3 ms 380 KB Output is correct
4 Incorrect 2 ms 376 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 320 KB Output is correct
2 Correct 3 ms 376 KB Output is correct
3 Correct 3 ms 380 KB Output is correct
4 Incorrect 2 ms 376 KB Output isn't correct
5 Halted 0 ms 0 KB -