Submission #405303

#TimeUsernameProblemLanguageResultExecution timeMemory
405303Andyvanh1Tropical Garden (IOI11_garden)C++14
Compilation error
0 ms0 KiB
#include "garden.h" #include "gardenlib.h" #include <iostream> #include <vector> #include <algorithm> #include <set> using namespace std; #define vt vector #define pb push_back #define all(x) x.begin(),x.end() typedef vt<int> vi; typedef long long ll; typedef pair<int,int> pii; vt<pair<int,int>> adjlist[150004]; vi adj[300008]; int nex[300008][31]; void gennex(){ for(int j = 1; j < 31; j++){ for(int i = 0; i < 300008; i++){ if(nex[i][j-1]==-1){ nex[i][j] = -1; }else{ nex[i][j] = nex[nex[i][j-1]][j-1]; } } } } int get(int i, int jmp){ for(int j = 0; j < 31; j++){ if(jmp&(1<<j)){ i = nex[i][j]; } } return i; } void count_routes(int n, int m, int p,vi r[],int q,vi g){ for(int i = 0; i < m; i++){ adjlist[r[0][i]].pb({i,r[1][i]}); adjlist[r[1][i]].pb({i,r[0][i]}); } for(int i = 0; i < n; i++){ sort(all(adjlist[i])); } for(int i = 0; i < n; i++){ int j1 = adjlist[i][0].second; if(adjlist[i].size()==1){ if(adjlist[j1].size()==1){ adj[i].pb(j1); }else if(adjlist[j1][0].second == i){ adj[i].pb(n+j1); }else{ adj[i].pb(j1); } continue; } if(adjlist[j1].size()==1){ adj[i].pb(j1); }else if(adjlist[j1][0].second == i){ adj[i].pb(n+j1); }else{ adj[i].pb(j1); } int j2 = adjlist[i][1].second; if(adjlist[j2].size()==1){ adj[i+n].pb(j2); }else if(adjlist[j2][0].second == i){ adj[i+n].pb(n+j2); }else{ adj[i+n].pb(j2); } } for(int i = 0; i < 2*n; i++){ if(adj[i].empty()){ nex[i][0] = -1; }else{ nex[i][0] = adj[i][0]; } } gennex(); for(int i = 0; i < q; i++){ int x = g[i]; int ans = 0; for(int j = 0; j < n; j++){ if(get(j,x)==p||get(j,x)==p+n){ ans++; } } answer(ans); } }

Compilation message (stderr)

/usr/bin/ld: /tmp/ccSaPy3o.o: in function `main':
grader.cpp:(.text.startup+0x3f): undefined reference to `count_routes(int, int, int, int (*) [2], int, int*)'
collect2: error: ld returned 1 exit status