제출 #398698

#제출 시각아이디문제언어결과실행 시간메모리
398698Pichon5열대 식물원 (Tropical Garden) (IOI11_garden)C++17
0 / 100
1 ms332 KiB
#include<bits/stdc++.h> #include <iostream> #include "garden.h" #include "gardenlib.h" #define lcm(a,b) (a/__gcd(a,b))*b #define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0); #define ll long long int #define vi vector<int> #define vll vector<ll> #define pb push_back #define F first #define S second #define mp make_pair using namespace std; void count_routes(int N, int M, int P, int R[][2], int Q, int g[]) { vi G[N]; for(int i=0;i<M;i++){ int a=R[i][0],b=R[i][1]; if(G[a].size()<2){ G[a].pb(b); } if(G[b].size()<2){ G[b].pb(a); } } int k=g[0]; int res=0; for(int i=0;i<N;i++){ int curr=i; int p=-1; for(int l=0;l<k;l++){ if(G[curr].size()==2){ if(G[curr][0]!=p){ p=curr; curr=G[curr][0]; }else{ p=curr; curr=G[curr][1]; } } if(G[curr].size()==1){ curr=G[curr][1]; } } if(curr==k)res++; } answer(res); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...