and check the set. Add the edge from the back.#include #includestring.h>#include#includeusing namespacestd;Const intMAXN =1000000+Ten;intFATHER[MAXN], U[MAXN], V[MAXN], Q, Q[MAXN], ANS[MAXN], FF[MAXN];intFindintx) { if(x = father[x]) father[x] =find (father[x]); returnfather[x];}intMain () {intN, M, I; while(~SCANF ("%d%d", n, m) {memset (FF,0,sizeof(FF)); for(i =0; I i; for(i =1; I "%d%d", u[i], V[i]); scanf ("%d", p); for(i =1; I "%d", q[i]); Ff[q[i]] =1; } inttot = n;//there are n sets
Problem-solving ideas: And check the water problems, many years ago with violent water.Problem Solving Code:1 //File name:c.c2 //Author:darkdream3 //Created time:2013 March 01 Friday 00:37 28 seconds4 5#include 6#include string.h>7#include 8#include 9#include Ten One BOOLa[102][102] = {0}; A intf[102]; - intb[102] = {0}; - intMain () { the - //freopen ("Input.txt", "R", stdin); - //freopen ("Output.txt", "w", stdout); - intN, m, p =0; +scanf"%d%d",n,m); - for(inti =1; I ) + { A
][j]); the printf ("******\n"); - }*/ $ while(!qu.empty ()) the { theQunode tmp =Qu.front (); the //printf ("%d\n", tmp.num); the Qu.pop (); -Mians = min (mians,yd-p[tmp.num].y); in the if(Tmp.num = = n+1) the { AboutOK =1; the returnTmp.step; the } the for(inti =0; i ) + { - if(!Vis[mp[tmp.num][i]]) the {Bayi //printf ("%d to%d\n", Tmp.num,mp[tmp.num][i]); theVis[mp[tmp.num][i]] =1; t
maintenance less, the wording is a lot more concise, I think if this idea, perhaps half an hour is enough to cross the problem, but the scene of my only endless DebugPrint the4page code. The time is soon to last one hours,Wddsaid he had crashed,BThe problem is not estimated.wkThere is no movement, I have a hint of foreboding. After the data has finally been sent, returnWA, the fault of the shady,wkthe last half hour was shot.J, but also wrong, regret the end. Later learnedMathloverand so many D
Simple topological ordering, output in dictionary order.#include #include#include#include#include#includeusing namespacestd;intn,m,u,v;Const intmaxn=1111;//set Number of nodesintINDEGREE[MAXN];//in degreesintPRI[MAXN];//OutputintTot//OutputintStart,end;//start and end of vertex numberingvectorint>G[MAXN];structcmp1{BOOL operator()(inta,intb) {returna>b;//Minimum value First}};p riority_queueint,vectorint>,cmp1>Q;voidToposort () {inti; for(I=start; i) if(!Indegree[i]) Q.push (i); whil
To ensure that we can reach the finish line, we need to meet the following two conditions1. Able to reach all summits2. Able to meet bitter potatoes faster than hisThe speed of the two can be done by the law of Conservation of energy, and the coordinates of the bitter potatoes can be made by triangular similarity.#include #include#include#include#include#include#includeusing namespacestd;#defineMOD 1000000007Const intinf=0x3f3f3f3f;Const Doubleeps=1e-5; typedefLong Longll;#defineCL (a) memset (A
http://acm.hdu.edu.cn/showproblem.php?pid=1285determine the position of the matchTime limit:2000/1000 MS (java/others) Memory limit:65536/32768 K (java/others)Total submission (s): 18484 Accepted Submission (s): 7399problem DescriptionThere are N teams (1Inputthe input has several groups, the first behavior in each group is two number n (1Outputgive a ranking that meets the requirements. There is a space between the queue numbers at the time of the output, and no space after the last. Other Note
Test instructions: Give you some boards up to 2 wide and let you put them in a box with a width of two and ask you how long the box is.Problem solving: DP, the nearest value from the middle.Problem Solving Code:1 //File name:a.cpp2 //Author:darkdream3 //Created time:2015 March 28 Saturday 12:13 56 seconds4 5#include 6#include 7#include 8#include Set>9#include Ten#include One#include A#include -#include -#include the#include -#include -#include -#include +#include -#include +#include
Enter the number of players N and the numbers of people you want to win, M,then enter the n * N of the winning and losing table, line I j column 1, representing I can win J.How many possibilities are there for M to win at the end and the minimum height of the total race tree?like Input:
7 2
0 1 0 0 0 1 0
0 0 1 0 1 1 1
1 0 0 1 1 0 0
1 1 0 0 0 1 0
1 0 0 1 0 0 1
0 0 1 0 1 0 0
1 0 1 1 0 1 0
The output:
139
#include Ideas:Dp[root][height][set] r
I played the regional game. Did not take the silver. Sad. cpp.Habitual vomit: This game is poisonous ...and rolled over to the end of the game. The middle of the fight with the teammates ... "Don't sleep on your thighs!" This is in the game .../(ㄒoㄒ)/~~ "I heard that the G-question is the cost flow of the board problem ... I heard that K can be violent.I heard someone is like us. Card B of the memory card a multipoint ... African peopleThe last three questions of copper ...Looking at the giant w
HDU 1285 determine the tournament positionTime limit:1000MS Memory Limit:32768KB 64bit IO Format:%i64d %i64 U DescriptionThere are N teams (1InputThe input has several groups, the first behavior in each group is two number n (1OutputGive a ranking that meets the requirements. There is a space between the queue numbers at the time of the output, and no space after the last.Other Notes: Qualifying rankings may not be unique, at which point the output
Determine the position of the matchTime limit:2000/1000 MS (java/others) Memory limit:65536/32768 K (java/others)Total submission (s): 20258 Accepted Submission (s): 8130Problem DescriptionThere are N teams (1InputThe input has several groups, the first behavior in each group is two number n (1OutputGive a ranking that meets the requirements. There is a space between the queue numbers at the time of the output, and no space after the last.Other Notes: Qualifying rankings may not be unique, at wh
BZOJ1299: [LLH Invitational Tournament] Chocolate bars (Nim game), bzoj1299llh
Time Limit: 10 Sec Memory Limit: 162 MB
Submit: 552 Solved: 331
[Submit] [Status] [Discuss]
Description
TBL and X play games with chocolate bars. Each time a person can take several chocolate bars out of the box, or eat one of the chocolate bars to a positive integer length. TBL takes two hands in turn and cannot be operated. They performed a total of 10 rounds (one bo
DescriptionThere are N teams (1InputThe input has several groups, the first behavior in each group is two number n (1OutputGive a ranking that meets the requirements. There is a space between the queue numbers at the time of the output, and no space after the last.Other Notes: Qualifying rankings may not be unique, at which point the output is required to be numbered in front of the team; the input data is guaranteed to be correct, i.e. the input data ensures that there must be a qualifying rank
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.