P3047 [USACO12FEB]附近的牛Nearby Cows
发布时间:2020-12-14 04:36:31 所属栏目:大数据 来源:网络整理
导读:https://www.luogu.org/problemnew/show/P304 ?1 #include bits/stdc++.h ?2 #define up(i,l,r) for(register int i = (l); i = (r); ++i) ?3 #define dn(i,r) for(register int i = (l); i = (r); --i) ?4 #define ll long long 5 #define re register 6 us
https://www.luogu.org/problemnew/show/P304?1 #include <bits/stdc++.h>?2 #define up(i,l,r) for(register int i = (l); i <= (r); ++i)?3 #define dn(i,r) for(register int i = (l); i >= (r); --i)?4 #define ll long long 5 #define re register 6 using namespace std; 7 8 template <typename T> void in(T &x) { 9 x = 0; T f = 1; char ch = getchar(); 10 while(!isdigit(ch)) {if(ch == ‘-‘) f = -1; ch = getchar();} 11 while( isdigit(ch)) {x = 10 * x + ch - 48; ch = getchar();} 12 x *= f; 13 } 14 15 template <typename T> void out(T x) { 16 if(x < 0) x = -x,putchar(‘-‘); 17 if(x > 9) out(x/10); 18 putchar(x%10 + 48); 19 } 20 21 int n,k; 22 const int N = 100007; 23 struct edge { 24 int v,nxt; 25 }e[N<<1]; int tot,head[N]; 26 void add(int u,int v) {e[++tot] = (edge){v,head[u]}; head[u] = tot;} 27 28 int f[2][N][25],c[N]; 29 30 void dfs1(int u,int fa) { 31 up(i,0,k) 32 f[0][u][i] = c[u]; (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |