hihocoder#1139 Two-point two answer

Source: Internet
Author: User

Original title Address

Quite simple a problem, the result because a moment silly to write wrong a small place, cause wa become a dog _ (: З"∠) _

Code:

1#include <iostream>2#include <cstring>3#include <queue>4 5 using namespacestd;6 7 #defineMax_v 100088 #defineMax_e 2000089 Ten intN, M, K, T; One intF[max_v]; A BOOLV[max_v]; - intN[max_e]; - intW[max_e]; the intT[max_e]; - intMax_w =1;; - intMin_w =1000000; -  + BOOLCheckintl) { -queue<pair<int,int> >Q; +memset (V,0,sizeof(v)); AQ.push (pair<int,int> (1, K)); at    while(!Q.empty ()) { -pair<int,int> P =Q.front (); - Q.pop (); -     if(P.first = = T && p.second >=0) -       return true; -     if(P.second = =0||V[p.first]) in       Continue; -V[p.first] =true; to      for(inti = F[p.first]; I! =0; i =N[i]) { +       if(W[i] > L | |V[t[i]]) -         Continue; theQ.push (pair<int,int> (T[i], P.second-1)); *     } $   }Panax Notoginseng   return false; - } the  + intFindintLintr) { A   intres =R; the    while(L <=r) { +     intm = (L + r)/2; -     if(check (m)) { $res =m; $r = M-1; -     } -     Else theL = m +1; -   }Wuyi   returnRes; the } -  Wu intMain () { -memset (N,0,sizeof(n)); Aboutscanf"%d%d%d%d", &n, &m, &k, &T); $    for(inti =0, j =0; i < M; i++) { -     intA, B, C; -scanf"%d%d%d", &a, &b, &c); -Min_w =min (Min_w, c); AMax_w =Max (Max_w, c); +J + +; theW[J] =C; -T[J] =b; $N[J] =F[a]; theF[a] =J; theJ + +; theW[J] =C; theT[J] =A; -N[J] =F[b]; inF[B] =J; the   } the   if(T = =1) Aboutprintf"0\n"); the   Else theprintf"%d\n", find (Min_w, max_w)); the   return 0; +}

hihocoder#1139 Two-point two answer

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.