[2016-04-16] [URAL] [2069] [Hard Rock]

Source: Internet
Author: User

  • Time: 2016-04-16-20:26:11 Saturday
  • Title Number: [2016-04-16][ural][2069][hard Rock]
  • Topic: Given a n*m lattice, each side of the lattice with a certain weight, peers or the same column of the Benquan value, ask from the top left to the bottom right corner of all the path, the minimum edge weight of what is the maximum?
  • Analysis:
    • For the starting point, either sideways or vertically, for the end, either sideways or vertically, so all the paths
    • For 1, 22 paths It is clear that the minimum value of the direct right to edge
    • For the path of the 3,4
      • First both sides of the road are certain, the middle road is uncertain,
      • Optimal situation, the middle of the path only need to select from the top to the bottom, the edge of the most important side can be, because if the halfway through the other vertical direction, the edge of the right can only be smaller
    • All in all, the answer is 4 cases of maximum ear value.
  • Problems encountered:
    • Just start to see the topic, Direct Dijkstra, write the number of points found there ten 5 x ten 5 5 x 5 One, and then hehe,
  
 
  1. #include<cstdio>
  2. #include<algorithm>
  3. using namespace std;
  4. const int maxn = 1E5 + 10;
  5. int a[maxn],b[maxn];
  6. int main(){
  7. int n,m;
  8. scanf("%d%d",&n,&m);
  9. int aa =0,bb = 0;
  10. for(int i = 0 ; i < n ; ++i){
  11. scanf("%d",&a[i]);
  12. aa = max(aa, a[i]);
  13. }
  14. for(int j = 0 ; j < m ; ++j){
  15. scanf("%d",&b[j]);
  16. bb = max(bb,b[j]);
  17. }
  18. int = min ( min ( b [ 0 " b Span class= "pun" >[ m - 1 aa
  19. int = min ( min ( a [ 0 ", a [ n - 1 ), bb
  20. int = min ( a [ 0 ], b [ m - Span class= "lit" >1
  21. int = min ( b [ 0 ], a [ n - Span class= "lit" >1
  22. printf("%d\n",max(t1,max(t2,max(t3,t4))));
  23. return 0;
  24. }


From for notes (Wiz)

[2016-04-16][ural][2069][hard Rock]

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.