Submission #354397

#TimeUsernameProblemLanguageResultExecution timeMemory
354397AmirElarbiTropical Garden (IOI11_garden)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #define vi vector<int> #define vf vector<float> #define ii pair<int,int> #define vvi vector<vi> #define vii vector<ii> #define pii pair<int,int> #define mp make_pair #define pb push_back #define fi first #define se second #define INF 1000 using namespace std; int n,m,p,q,res,cur, aff; vii r; vi g,par; void dfs(int u){ //cout << u << " "; if(res > cur){ return;} if(res == cur && u == p) {aff++;return;} int p = 0; bool parent = false; for(int i = 0; i < m; i++){ if(r[i].fi == u || r[i].se == u){ int v = (r[i].fi == u) ? r[i].se : r[i].fi; if(par[u] != v){ res++; par[v] = u; parent = false; dfs(v); break; } else if (par[u] == v && par[v] != u){ p = v; parent = true; } } } if(parent) { res++; par[p] = u; dfs(p); } } void count_routes(int N, int M, int P, int R[][2], int Q, int G[]){ ios_base::sync_with_stdio(false); cin.tie(NULL); n = N; m = M; p = P; for(int i = 0; i < m; i++){ r.pb(mp(R[i][0],R[i][1])); } q = Q; for(int i = 0; i < q; i++){ g.pb(G[i]); } for(int i = 0; i < q; i++){ aff = 0; for(int j = 0; j < m; j++){ par.assign(n,-1); cur = g[i]; res = 0; dfs(j) ; //cout << endl; } answer(aff); } }

Compilation message (stderr)

garden.cpp: In function 'void count_routes(int, int, int, int (*)[2], int, int*)':
garden.cpp:66:9: error: 'answer' was not declared in this scope
   66 |         answer(aff);
      |         ^~~~~~