Poj 3592 instantaneous transference
Question Link
Question: A graph can go to the right and down, And then * can be transferred to a position. '#' cannot go. After walking through a point, you can obtain the number value above the point, how much can be obtained
Idea: because there is a strong link contraction point in a ring, and then the problem is converted to Dag, directly DP.
Code:
#include
Poj 3592
A map with a number indicates that there are digits and minerals on it. * indicates that this point can be transferred to another point. # indicates that it cannot be taken. Only the lower and right sides of a vertex can be reached. Now, starting from (0, 0), ask how many minerals can be collected at most.
Train of Thought: This question must be illustrated, and then the longest path, the key is that with the transfer, it is possible to form a right ring, and then it will die in the spfa proces
+memset (Dist,0x3f,sizeof(Dist));//Distance Adequeint> Que (1, ST); theinq[st]=1; +dist[st]=0; - while(!que.empty ()) $ { $ intt=Que.front (); Que.pop_front (); -inq[t]=0; node E; - for(intI=HEAD[T]; i!=-1; I=e.next) the { -E=Edge[i];Wuyi if(dist[e.to]>dist[t]+E.dis) the { -dist[e.to]=dist[t]+E.dis; Wu if(!inq[e.to])//not in the queue - { About if(++cnt[e.to]>n)//too many times in the q
Click to open linkTest instructions: There are n individuals, and then x relationship and y relationship, the x relationship represents that the distance of these two people can not exceed c,y represents the distance of these two people is greater than or equal to C, if not meet all the output-1, if the position of 1 and n can be infinitely large output-2, otherwise the maximum distance to output two peopleIdea: is to check the model of the constraint, x relationship according to the location of
, output-1. If Person 1 and N can is arbitrarily far apart, output-2. Otherwise output The greatest possible distance between person 1 and N.Sample Input14 2 11 3 82 4 152 3 4Sample Output19Authoralpc20Source2010 acm-icpc multi-university Training Contest (--host by Nudt)/* ***********************************************author:ckbosscreated time:2015 July 30 Thursday 08:16 29 seconds file Name : hdoj3592.cpp************************************************ * * #include Copyright NOTICE: This art
coordinates of the arrival of the minerals owned by the edge of the weight value. The question then becomes: the longest path the minecart can reach from node 0. But in addition to the right and down the edge, considering the transmission point and the target coordinates are composed of edges, the original image will be much more back to the edge, forming a lot of the forward ring. The emergence of a forward ring, so that the mine can be picked up a part of the mineral, as long as it can go int
HDOJ 3592 World Exhibition difference constraint, hdoj3592
World Exhibition
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission (s): 1373 Accepted Submission (s): 673
Problem DescriptionNowadays, please people want to go to Shanghai to visit the World Exhibition. so there are always a lot of people who are standing along a straight line waiting for entering. assume that there are N (2
There is something
World Exhibition
Time Limit: 2000/1000 MS (Java/others) memory limit: 32768/32768 K (Java/Others)Total submission (s): 568 accepted submission (s): 264Problem description
Nowadays,
Please people want to go to Shanghai to visit the world exhibition.
Question: There are several points on the plane, and the minimum spanning tree is obtained. There are a maximum of 8 packages. Each package has a price and a number of points. Once purchased, the points in the package will be connected to each other.
World ExhibitionTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission (s): 931 Accepted Submission (s): 468 Problem DescriptionNowadays, please people want to go to Shanghai to visit the World Exhibition.
It is very difficult for others to answer questions... Alas
First, this question is abstracted into a directed graph. Due to the existence of magic power, this graph has a ring, so I think of the method of reducing points with strongly connected
/* Question: Given a matrix, the southwest corner is the starting point. Each unit has a valuable gold mine (# indicates rock, inaccessible, * indicates space-time gate, and can reach a specified Unit) what benefits can be obtained at most? Strong
Click to open link
Test instructions: There are n individuals, and then x relationship and y relationship, the x relationship represents that the distance of these two people can not exceed c,y represents the distance of these two people is greater
Oracle tree query. If you need it, refer to it. The code is messy. Sorry.
Oracle tree query. If you need it, refer to it. The code is messy. Sorry.
Format:
SELECT column
FROM table_name
Start with column = value
Connect by prior parent primary key = Child foreign key
Select lpad ('', 4 * (level-1) | name, job, id, super from emp
Start with super is null
Connect by prior id = super
Example:
Raw data: select no, q from a_example2
NO NAME
----------------------------------------
001 a01
001 a02
00
Format:
Select column
From table_name
Start with column = Value
Connect by prior parent primary key = Child foreign key
Select lpad ('', 4 * (level-1) | Name, job, ID, super from EMP
Start with super is null
Connect by prior id = super
Example:
Raw data: Select No, Q from a_example2
No name
----------------------------------------
001 A01
001 A02
001 A03
001 a04
001 a05
002 B01
003 c01
003 C02
004 d01
005 e01
005 e02
005 e03
005 e04
005 e05
The result
Format:Select columnFrom table_nameStart with column = ValueConnect by prior parent primary key = Child foreign key
Select lpad ('', 4 * (level-1) | Name, job, ID, super from EMPStart with super is nullConnect by prior id = super
Example:Raw data: Select No, Q from a_example2
No name----------------------------------------001 A01001 A02001 A03001 a04001 a05002 B01003 c01003 C02004 d01005 e01005 e02005 e03005 e04005 e05
The result is as follows:001 A
, row_number () over (order by no, name desc) rn from a_example2))Start with rn1 is null connect by rn1 = prior rnGroup by noStatement Analysis:1. select no, name, row_number () over (order by no, name desc) rn from a_example2Sort by NO in ascending order, and sort by NAME in descending order to generate pseudo columns to form a Tree StructureNO NAME RN001 a03 1001 a02 2001 a01 3002 b01 4003 c02 5003 c01 6004 d01 7005 e05 8005 e04 9005 e03 10005 e02 1
Note:
1. "A" in from (select distinct classname from #) A must be available. The record set obtained from (select distinct classname from #) is treated as a new table.
2. When a group by statement is used in an SQL statement, functions such as Count (), sum (), AVG (), max (), and min () are generally used;
However, if you directly use these functions without using the group by statement, all datasets are treated as a group for processing.
Question 2:
The schema of a relational database is kn
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.