제출 #28863

#제출 시각아이디문제언어결과실행 시간메모리
28863dereotu열대 식물원 (Tropical Garden) (IOI11_garden)C++14
0 / 100
4 ms632 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; map<string,int> h; string s=""; void dfs(int x,int y,int k){ if(k==g and x==p){ //cout<<s<<endl; h[s]=1; ans++; return; } else if(k>=g) return; int l=s.size(); forr(i,0,adj[x].size()){ if(adj[x][i].nd==y and adj[x].size()==1){ s+=y; dfs(y,x,k+1); break; } else if(adj[x][i].nd!=y){ s+=(char)adj[x][i].nd; dfs(adj[x][i].nd,x,k+1); break; } } s.resize(l); } 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); } for(int i=0; i<Q; i++){ answer(h.size()); } }

컴파일 시 표준 에러 (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:28:7:
  forr(i,0,adj[x].size()){
       ~~~~~~~~~~~~~~~~~           
garden.cpp:28: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...