常用调试用函数
void print_array(int a[],int l){ for(int i=1;i<=l;i++){ printf("%d ",a[i]); } printf("\n"); } void print_tree(int tree[]){ printf("root=%d\n",tree[root].val); for(int i=0;i<=tot;i++){ printf("%d:lson(%d) rson(%d)\n",tree[i].val,tree[lson(i)].val,tree[rson(i)].val); } printf("\n"); } void print_vec(vector<int> a){ for(int i=0;i<a.size();i++){ printf("%d ",a[i]); } } void print_graph(){ for(int i=1;i<=tot;i++){ printf("%d --->%d:%d\n",e[i].f,e[i].t,e[i].w); } } void print_dp(int a,int b){ for(int i=1;i<=a;i++){ for(int j=1;j<=b;j++){ printf("dp[%d][%d]=%d",i,j,dp[i][j]); } } } void print_double_vector(int a){ for(int i=1;i<=a;i++){ printf("%d:",i); for(int j=0;j<vec[i].size();j++) printf("%d ",vec[i][j]); printf("\n"); } } int main(){ return 0; }
This is your dream.Anything you can dream,you can do it now.