Submission #354394

#TimeUsernameProblemLanguageResultExecution timeMemory
354394AmirElarbiTropical 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); } } int main(){ ios_base::sync_with_stdio(false); cin.tie(NULL); cin >> n >> m >> p; for(int i = 0; i < m; i++){ int a,b; cin >> a >> b; r.pb(mp(a,b)); } cin >> q; for(int i = 0; i < q; i++){ int a; cin >> a; g.pb(a); } 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; } cout << aff << " "; } return 0; }

Compilation message (stderr)

/tmp/cccCTMU6.o: In function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'
/tmp/cc5WLsf5.o:garden.cpp:(.text.startup+0x0): first defined here
/tmp/cccCTMU6.o: In function `main':
grader.cpp:(.text.startup+0x3b): undefined reference to `count_routes(int, int, int, int (*) [2], int, int*)'
collect2: error: ld returned 1 exit status