BZOJ3389 [usaco Dec] Cleaning Shifts schedule duty

Source: Internet
Author: User

Bare shortest path...

Creating a graph is still subtle... But it doesn't feel fast...

Create a vertex at each time point. Then, we can build a graph in two steps:

(1) I point in time connects a directed edge to the I-1 point in time

(2) If there is a ox [l, r], then l-1 connects an edge to r

The last answer is dis [T].

Think about it and think it's very clever... But it's slow...

 

1 /************************************** * *********************** 2 Problem: 3389 3 User: rausen 4 Language: C ++ 5 Result: Accepted 6 Time: 652 MS 7 Memory: 33064 kb 8 ************************************* * *************************/9 10 # include <cstdio> 11 # include <algorithm> 12 # include <vector> 13 # include <queue> 14 15 using namespace std; 16 const int inf = (int) 1e9; 17 const int N = 1000005; 18 co Nst int M = N * 2; 19 struct edges {20 int next, to, v; 21} e [M]; 22 struct heap_node {23 int v,; 24} NODE; 25 inline bool operator <(const heap_node & a, const heap_node & B) {26 return. v> B. v; 27} 28 29 int n, d [N], T; 30 int tot, first [N]; 31 bool vis [N]; 32 33 priority_queue View Code

(P.s. Orz iwtwiioi is so greedy)

BZOJ3389 [usaco Dec] Cleaning Shifts schedule duty

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.