[Bzoj1143] the question of ctsc... Use floyed to pass the closure, and then directly use the Hungary algorithm.
[Bzoj1452] a two-dimensional tree array that has never been written. It seems very simple ..
struct two_bit{ int f[305][305]; inline void add(int x,int z,int A) { for (;x<=n;x+=L(x)) for (int y=z;y<=m;y+=L(y)) f[x][y]+=A; } inline int ask(int x,int z) { int ans=0; for (;x;x-=L(x)) for (int y=z;y;y-=L(y)) ans+=f[x][y]; return ans; }}a[105];
[Bzoj1876] High-Precision GCD. But the implementation card is very tight. If it is a bare GCD, whether it is time-out or not, the code length alone is chilling. (For details, see my vijos1047 solution.) You can use the binary GCD for optimization.
If A and B are even numbers, gcd (a, B) = gcd (A/2, B/2)
If a is an odd number and B is an even number, gcd (a, B) = gcd (A, B/2)
If a is odd, B is odd, gcd (a, B) = gcd (A-B, B)
Until one of A and B is 0, or a = B.
[Bzoj3038 & 3211] initially thought it was a God question, and later found a nature: Even if a number is operated by a violent root number, it will become 1 after several times. (The major issue is 0 !!!) So we can use the line tree to modify it.
[Bzoj1695 & 1743] This permission question has left me weak for a long time. At first I went backwards, and there were child nodes in the letter tree to update the parent node-but there was more than crazy wa. So I started updating the subnode and finally got.
for (i=1;i<=n;i++) for (j=m;j;j--) for (k=1;k<=num[map[i][j]];k++) { x=record[map[i][j]][k]; if (flag[x]) for (p=1;p<=j;p++) c[x][p]++; for (son=0;son<26;son++) if ((t=tree[x][son])>-1) for (p=1;p<=j;p++) c[x][p]+=c[t][j]; } for (son=0;son<26;son++) if (tree[0][son]>-1) ans+=c[tree[0][son]][1];
[Bzoj3170] Typical coordinate reconstruction.
for (i=1;i<=n;i++) { scanf("%lld%lld",&x,&y);a[i].x=x+y;a[i].y=x-y; a[i].id=i;endx+=a[i].x;endy+=a[i].y; }
[Bzoj3319] I honestly said: "violent rank1, can you believe it?
[Bzoj1765 & 1356] What is the largest area? Card time! First, locate all the diagonal lines and sort them in order. Enumeration from big to small is a set of equal diagonal lines. Once matched, the break is witty.
[Bzoj1879] looking at the question, it is a simple pressure DP.
f[0][0]=1; for (i=0;i<len;i++) for (status=0;status<(1<<n);status++) if (f[i][status]) for (j=0;j<26;j++) up(f[i+1][status|c[i+1][j]],f[i][status]);
[Bzoj1226] God-like pressure! Note a property: Bi <= 7, that is, for a certain point, only the first seven and the last seven points are affected.
PS: A or B-A and B is not a xor B?
f[1][0][-1+A]=0; for (i=1;i<=n;i++) for (status=0;status<256;status++) for (k=-8;k<=7;k++) if (f[i][status][k+A]<INF) { if (status&1) {up(f[i+1][status>>1][k-1+A],f[i][status][k+A]);continue;} r=INF; for (j=0;j<=B[i];j++) if (!(status&(1<<j))) { if (i+j>r) break; up(r,B[i+j]+i+j); up(f[i][status|(1<<j)][j+A],f[i][status][k+A]+cost(i+k,i+j)); } }