Submission #592423

#TimeUsernameProblemLanguageResultExecution timeMemory
592423fuad27Tropical Garden (IOI11_garden)C++17
49 / 100
5 ms856 KiB
#include "garden.h" #include "gardenlib.h" #include<bits/stdc++.h> using namespace std; const int N = 1010; vector<int> g[N]; bool check(int at,int e, int k) { int p=at; for(int i = 0;i<k;i++) { if(g[at].size()>1 and g[at][0]==p) { p=at; at=g[at][1]; } else { p=at; at=g[at][0]; } } if(at==e)return true; return false; } void count_routes(int N, int M, int P, int R[][2], int Q, int G[]) { 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 i = 0;i<Q;i++) { int ans=0; for(int j = 0;j<N;j++) { if(check(j, P, G[i])){ ans++; } } answer(ans); } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...