Submission #225600

# Submission time Handle Problem Language Result Execution time Memory
225600 2020-04-20T23:05:29 Z AmineWeslati Tropical Garden (IOI11_garden) C++17
Compilation error
0 ms 0 KB
#include "gardenlib.h"
// O O O O O O O O O O O O O O O OO O OO O OO O O O TTCH O TTTCH O TTTCH O O O O
#pragma GCC optimize("Ofast")
#pragma GCC optimize("no-stack-protector")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("fast-math")
#pragma GCC target("sse,sse2,sse3,ssse3,popcnt,abm,mmx")
#include <iostream>
#include <bits/stdc++.h>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <stdio.h>
#include <cstdio>
#include <math.h>
#include <cmath>
#include <string>
#include <cstring>
#include <queue>
#include <deque>
#include <random>
#include <iomanip>
#include <bitset>
#include <cassert>
// #include "grader.h"

using namespace std;

typedef string str;
typedef long long ll;
#define int ll
typedef double db;
typedef long double ld;

typedef pair<int,int> pi;
#define mp make_pair
#define fi first
#define se second

typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<ll> vl;
typedef vector<db> vd;
typedef vector<str> vs;
typedef vector<pi> vpi;

#define pb push_back
#define eb emplace_back
#define pf push_front

#define lb lower_bound
#define ub upper_bound

#define sz(x) (int)x.size()
#define all(x) begin(x), end(x)

const int MOD = 1e9+7; //998244353
const ll INF = 1e18;
const int nx[4]={0,0,1,-1}, ny[4]={1,-1,0,0};

const int MXN=150000+1;

//int N, M, P, R[MXN][2], Q, G[2001];

int ans;
int V,E,D;
vpi g[MXN];
int num;
vi p;

void dfs(int u, int c){
   if(c==num && u==D){ans++; return;}
   if(c==num) return;
   int mx=0,v=-1;
   for (auto x: g[u]){
      if(g[u].size()==1){ v=x.fi; break;}
      if(x.se>mx && p[u]!=x.fi){mx=x.se; v=x.fi;}
   }
   p[v]=u;
   dfs(v,c+1);
   return;
}

void count_routes(int N, int M, int P, int R[][2], int Q, int G[]){
   V=N; E=M; D=P;
   int w=E;
   for (int i=0; i<E; i++){
      int a=R[i][0],b=R[i][1];
      g[a].pb({b,w});
      g[b].pb({a,w});
      w--;
   }
   for (int q=0; q<Q; q++){
      ans=0; num=G[q];
      for (int i=0; i<V; i++){p.assign(V,-1); dfs(i,0);}
      answer(ans);
   }
}

/*int main(){
   return 0;
}*/


/*
6 6 0

1 2
0 1
0 3
3 4
4 5
1 5

1
3

*/

/*

5 5 2

1 0
1 2
3 2
1 3
4 2

2
3
1
*/

Compilation message

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