October 3 Konjac Konjac Diary

Source: Internet
Author: User

Originally from yesterday began to want to record the national day these days of the Austrian race Life ( results because lazy.

Well, let's start today (the results are just beginning today .)

------------------------------------------------------8:23

Need to dream of handsome in the middle of the night to start writing? ( what dog

Would you like to start off with a cup of original coffee mixed with an Austrian crush in the morning?

Need to cool off from today and wrap a coat to the school to write it?

Forget the teacher came this morning is a mock exam ...

------------------------------------------------------8:31

It's about half an hour before the end of the exam. A bit of a panic ...

T1 Figure The EMM first reverse two times the shortest, and then follow the topological sequence to DP, but the problem is not guaranteed
There is no ring in the map (I don't know how many points there will be.)
T2 looks like a tree DP, but does not, according to the data range hit 50 points of violence (if not even 50.)
。 )
T3 good, completely ignorant force. Blindly pushed some mysterious nature, but still do not know how to do Ah, wrote a
There is no way to get points of the cheat points.

The best thing is to get 150 points, maybe not even 100 points.

----------------------------------------------------11:35

The teacher is still giving a lecture to the tall, no time to come to us to evaluate 12:10

Submit Success 12:13

In-situ explosion of the first question only 40 points, sure enough the picture is a ring! 12:22

Came to school to start digesting 14:51

T1 only three times the shortest way to solve AH ah ah Ah!

T1 completed-------15:13:06

T2 completed-------16:37:03

It feels like the T2 is a little unclear. Write a good one.

The topics are as follows

" of a very confusing and useless nature. Sample "

8 Ten 2 5 9  One  the  +  - 1 4 1 3 1 7 4 6 2 8 2 3 3 5

Tree dp That's going to have to write the DP equation. observed that n is small so

F[U][CU] represents the assumption that at this point the nearest center of the U Point is at the CU Point, at which time the sum of the cost of the entire subtree (note that the K value is not added at the center of the CU establishment)

And then every time you update the time to find all the direct son of U set to v OK, can be updated directly with F[V][CU], but if the nearest center of V is not CU, but is CV, then in the subtree of V to enumerate all CVs to find a minimum of F[V][CV], with f[v][cv]+k to update, Then why do you add K now? Since the CV is in the subtree of V, the center of U is not a CV but a CU, and it is a certainty that you have this CV built as a center, and you must add K.

You can then use the Floyd to process the distance between any two points, the code is as follows

1#include <iostream>2#include <cstdio>3#include <cstdlib>4#include <cstring>5#include <algorithm>6 7 #definefor (I,A,B) for (register int i=a;i<=b;++i)8 #defineRe Register9 #defineINF 0x7f7f7fTen using namespacestd; One Const intn= About; A intF[n][n]; - intD[n][n],dx[n]; - inthead[n],nxt[n*2],v[n*2],cnt=0, NF; the intN,m,x,y,z,kx; -InlinevoidReadint&v) { -v=0; -     CharC=GetChar (); +      while(c<'0'|| C>'9') c=GetChar (); -      while(c>='0'&&c<='9') v=v*Ten+c-'0', c=GetChar (); + } A voidAddintUxintVX) { atcnt++; -Nxt[cnt]=head[ux]; head[ux]=cnt; v[cnt]=VX; -cnt++; -NXT[CNT]=HEAD[VX]; head[vx]=cnt; v[cnt]=UX; - } -  in intdfx[n],tot=0, bh[n],sz[n]; - voidDFS (intXintFA) { todfx[++tot]=x; +sz[x]=1; bh[x]=tot; -      for(ReintI=head[x];i;i=nxt[i])if(v[i]!=FA) { the DFS (v[i],x); *sz[x]+=Sz[v[i]]; $     }Panax Notoginseng } -  the voidTRDP (intXintFA) { +for (I,1, N) f[x][i]=Dx[d[x][i]]; A      for(ReintI=head[x];i;i=nxt[i])if(v[i]!=FA) { the         intvv=V[i]; + trdp (vv,x); -         intmn=NF; $for (j,bh[vv],bh[vv]+sz[vv]-1){ $mn=min (mn,f[vv][dfx[j]]); -         } -For (J,1, N) f[x][j]+=min (f[vv][j],mn+kx); the     }     - }Wuyi  the intMain () { - //freopen ("ex.in", "R", stdin); WuFreopen ("logistics.in","R", stdin); -Freopen ("Logistics.out","W", stdout); About read (n); Read (KX); $for (I,1, N-1) read (Dx[i]); -memset (D,inf,sizeof(d)); -nf=d[0][0]; -for (I,1, N-1){ A read (x); Read (y); + Add (x, y); thed[x][y]=d[y][x]=1; -     } $      thefor (I,1, N) d[i][i]=0; theFor (K,1, n) for (I,1, N) for (J,1, N) the         if(i!=j&&j!=k&&k!=i&&d[i][k]!=nf&&d[k][j]!=NF) { theD[i][j]=min (d[i][j],d[i][k]+d[k][j]); -         } in          the          theDFS (1,0); AboutTRDP (1,0); the     intfn=NF; thefor (I,1, N) fn=min (fn,f[1][i]+kx); thecout<<fn<<Endl; + fclose (stdin); fclose (stdout); -     return 0;  the}

17:13:25

18:33:30 back to the classroom to water the freshly sprouted chrysanthemum, and then prepare to participate in the Rokua simulation game

35 minutes to the end of 21:55:23, it feels good (?) Hope to get full marks (?) )

After all, today's Rokua is a big fortune.

22:34:45

AK , but there are 14 people AK. And I am the penultimate, not too happy, not too happy ...

Write the idea briefly (it must be because the T2 opened the useless three-dimensional DP array is slow and the same as the dog )

T1 According to the arrangement can be introduced a general formula ans= nx2n-1-(2n-1) OK, but the process on the draft paper is miserable

T2 DP question (open a three-dimensional array)F[I][J][0/1] I portal, time to J, whether the first portal is taken, and then open a PA array to record where it was updated, and finally go back to find all the scenarios.

T3 originally thought that NOIP will not test the network flow, think of more than 20 minutes of other algorithms, and later found that can be directly network flow map (those who have not learned the network flow of the noiper is a bit pathetic) so each point is split into two, build a model similar to the two-dimensional graph, flow maximum flow to determine whether there is a plan OK. Finally, all the schemes are found on the residual flow graph, and the output can be.

———————————— 23:00:59 ————————————

All right, go home and sleep, and that's it today.

You can hear it in the silence~ silence~ you~~

You can feel it on the the-the-home~-home~ you~~

You can see it when the lights out~ light out~ you~~

--taylor Swift " You is in Love"

October 3 Konjac Konjac Diary

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.