【BZOJ2878】【NOI2012】迷失游乐园(动态规划)
BZOJ 记得以前考试的时候做过这道题目 这题的暴力还是非常显然的,每次 d f s d f s 一下就好了。 时间复杂度 O ( n 2 ) O ( n 2 ) #include<iostream> #include<cstdio> #include<cstdlib> #include<cstring> #include<cmath> #include<algorithm> #include<set> #include<map> #include<vector> #include<queue> using namespace std ; #define ll long long #define RG register #define MAX 111111 inline int read() { RG int x= 0 ,t= 1 ;RG char ch=getchar(); while ((ch< '0' ||ch> '9' )&&ch!= '-' )ch=getchar(); if (ch== '-' )t=- 1 ,ch=getchar(); while (ch<= '9' &&ch>= '0' )x=x* 10 +ch- 48 ,ch=getchar(); return x*t; } struct Line{ int v,next,w;}e[MAX<< 1 ]; int h