Submission #28865

#TimeUsernameProblemLanguageResultExecution timeMemory
28865dereotuTropical Garden (IOI11_garden)C++14
0 / 100
3 ms636 KiB
#include "garden.h" #include "gardenlib.h" #include <bits/stdc++.h> #define pii pair<int,int> #define mp make_pair #define pb push_back #define st first #define nd second #define forr(i,A,B) for(int i=A;i<B;++i) #define space ' ' #define endl '\n' #define LL long long using namespace std; vector <pair<int,int> > adj[10005]; int g,ans,p; void dfs(int x,int y,int k){ if(k==g and x==p){ ans++; return; } else if(k>=g) return; forr(i,0,adj[x].size()){ if(adj[x][i].nd==y and adj[x].size()==1){ dfs(y,x,k+1); break; } else if(adj[x][i].nd!=y){ dfs(adj[x][i].nd,x,k+1); break; } } } void count_routes(int N, int M, int P, int R[][2], int Q, int G[]){ forr(i,0,N){ adj[R[i][0]].pb(mp(i,R[i][1])); adj[R[i][1]].pb(mp(i,R[i][0])); } forr(i,0,N){ sort(adj[R[i][0]].begin(),adj[R[i][0]].end()); sort(adj[R[i][1]].begin(),adj[R[i][1]].end()); } g=G[0]; p=P; forr(i,0,N){ dfs(i,i,0); } if(N<=2) assert(!1); for(int i=0; i<Q; i++){ answer(ans); } }

Compilation message (stderr)

garden.cpp: In function 'void dfs(int, int, int)':
garden.cpp:9:34: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
 #define forr(i,A,B) for(int i=A;i<B;++i)
garden.cpp:23:7:
  forr(i,0,adj[x].size()){
       ~~~~~~~~~~~~~~~~~           
garden.cpp:23:2: note: in expansion of macro 'forr'
  forr(i,0,adj[x].size()){
  ^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...