https://vjudge.net/problem/UVALive-3211

As you must have experienced, instead of landing immediately, an aircraft sometimes waits in a holding loop close to the runway. This holding mechanism is required by air traffic controllers to space apart aircraft as much as possible on the runway (while keeping delays low). It is formally defined as a “holding pattern” and is a predetermined maneuver designed to keep an aircraft within a specified airspace.

Jim Tarjan, an air-traffic controller, has asked his brother Robert to help him to improve the behavior of the airport.

The TRACON area

The Terminal Radar Approach CONtrol (TRACON) controls aircraft approaching and departing when they are between 5 and 50 miles of the airport. In this final scheduling process, air traffic controllers make some aircraft wait before landing. Unfortunately this “waiting” process is complex as aircraft follow predetermined routes and their speed cannot be changed. To reach some degree of flexibility in the process, the basic delaying procedure is to make aircraft follow a holding pattern that has been designed for the TRACON area. Such patterns generate a constant prescribed delay for an aircraft (see Figure 1 for an example). Several holding patterns may exist in the same TRACON.

In the following, we assume that there is a single runway and that when an aircraft enters the TRACON area, it is assigned an early landing time, a late landing time and a possible holding pattern. The early landing time corresponds to the situation where the aircraft does not wait and lands as soon as possible. The late landing time corresponds to the situation where the aircraft waits in the prescribed holding pattern and then lands at that time. We assume that an aircraft enters at most one holding pattern. Hence, the early and late landing times are the only two possible times for the landing.

The security gap is the minimal elapsed time between consecutive landings. The objective is to maximize the security gap. Robert believes that you can help.

Input The input file, that contains all the relevant data, contains several test cases Each test case is described in the following way. The first line contains the number n of aircraft (2 ≤ n ≤ 2000). This line is followed by n lines. Each of these lines contains two integers, which represent the early landing time and the late landing time of an aircraft. Note that all times t are such that 0 ≤ t ≤ 107 .

Output For each input case, your program has to write a line that conttains the maximal security gap between consecutive landings. Note: The input file corresponds to Table 1.

Sample Input 10 44 156 153 182 48 109 160 201 55 186 54 207 55 165 17 58 132 160 87 197

Sample Output 10

//有空再来写翻译和思路,调了好久才AC(事实上就是把和标程不一样的地方改过来...)

 #include<iostream>
 #include<vector>
 #include<cstdio>
 #include<cmath>
 #include<cstring>
 using namespace std;
 ;
 struct TwoSet{
     ],S[maxn*];
     int n,c;
     vector<];
     void init(){
         ;i<n*;i++) G[i].clear();
         memset(mark,,sizeof(mark));
     }
     void add(int x,int xval,int y,int yval){
         x=x*+xval;
         y=y*+yval;
         G[x^].push_back(y);
         G[y^].push_back(x);
     }
     bool dfs(int u){
         ]) return false;
         if(mark[u]) return true;
         mark[u]=;
         S[c++]=u;
         ;i<G[u].size();i++) if(!dfs(G[u][i])) return false;
         return true;
     }
     bool Judge(){
         ;i<n*;i+=){
             ]){
                 c=;
                 if(!dfs(i)){
                     ) mark[S[--c]]=;
                     )) return false;
                 }
             }
         }
         return true;
     }

 };
 TwoSet solver;
 ];
 bool check(int x){
     solver.init();
     ;i<n;i++) ;a<;a++)
         ;j<n;j++) ;b<;b++)
             ,j,b^);
     return solver.Judge();
 }
 int main()
 {
     &&n){
         ,R=;
         solver.n=n;
         ;i<n;i++) ;a<;a++)
         scanf("%d",&T[i][a]),R=max(R,T[i][a]);
         while(L<R){
         )/;
         if(check(M)) L=M;
         ;
         }
         printf("%d\n",L);
     }
     ;
 }

LA3211 飞机调度 Now or later-二分法&TwoSet的更多相关文章

  1. 【LA3211 训练指南】飞机调度 【2-sat】

    题意 有n嫁飞机需要着陆.每架飞机都可以选择“早着陆”和“晚着陆”两种方式之一,且必须选择一种.第i架飞机的早着陆时间为Ei,晚着陆时间为Li,不得在其他时间着陆.你的任务是为这些飞机安排着陆方式,使 ...

  2. LA 3211 飞机调度

    题目链接:http://vjudge.net/contest/142615#problem/A 题意:n架飞机,每架可选择两个着落时间.安排一个着陆时间表,使得着陆间隔的最小值最大. 分析: 最小值最 ...

  3. 【LOJ】#2077. 「JSOI2016」飞机调度

    题解 考虑一架飞机飞完自己之后还能飞到哪些航线,用floyd求两点最短路 这个图建出来是个DAG,求最小路径覆盖即可,二分图匹配 注意判断时是航班的起飞时刻+直飞时间+加油时间+最短路时间 代码 #i ...

  4. LA 3211 飞机调度(2—SAT)

    https://vjudge.net/problem/UVALive-3211 题意: 有n架飞机需要着陆,每架飞机都可以选择“早着陆”和“晚着陆”两种方式之一,且必须选择一种,第i架飞机的早着陆时间 ...

  5. 飞机调度 Now or Later? LA 3211 (2-SAT问题)

    洛谷题目传送门 题目描述 有n架飞机需要着陆.每架飞机都可以选择“早着陆”和“晚着陆”两种方式之一,且必须选择一种.第i架飞机的早着陆时间为Ei,晚着陆时间为Li,不得在其他时间着陆.你的任务是为这些 ...

  6. BZOJ 4853 [Jsoi2016]飞机调度

    题解: 我严重怀疑语文水平(自己的和出题人的) 把航线按照拓扑关系建立DAG 然后最小路径覆盖 为什么两条首尾相接航线之间不用维护???? #include<iostream> #incl ...

  7. (纪录片)现代生活的秘密规则:算法 The Secret Rules of Modern Living: Algorithms

    简介: The Secret Rules of Modern Living: Algorithms (2015) 导演: David Briggs主演: Marcus du Sautoy类型: 纪录片 ...

  8. JSOI部分题解

    JSOI部分题解 JSOI2018 战争 问题转化为给定你两个凸包\(\mathbb S,\mathbb T\),每次独立的询问将\(\mathbb T\)中的每个点移动一个向量,问\(\mathbb ...

  9. CDN调度器HAProxy、Nginx、Varnish

    http://www.ttlsa.com/web/the-cdn-scheduler-nginx-haproxy-varnish/ CDN功能如下:1.将全网IP分为若干个IP段组,分组的依据通常是运 ...

随机推荐

  1. 解决RPM包相互依赖的有效方法

    出自:http://blog.csdn.net/kai27ks/article/details/7473683 前言:常用RPM的朋友们都知道,RPM简单易用,但是它的依赖关系是最头疼的!有时候比方说 ...

  2. c#处理3种json数据的实例

    网络中数据传输经常是xml或者json,现在做的一个项目之前调其他系统接口都是返回的xml格式,刚刚遇到一个返回json格式数据的接口,通过例子由易到难总结一下处理过程,希望能帮到和我一样开始不会的朋 ...

  3. Python处理Excel文档(xlrd, xlwt, xlutils)

    简介 xlrd,xlwt和xlutils是用Python处理Excel文档(*.xls)的高效率工具.其中,xlrd只能读取xls,xlwt只能新建xls(不可以修改),xlutils能将xlrd.B ...

  4. 黄聪:查看mysql数据库真正的data目录

    终于找到了mysql数据库data目录在哪里! 用show variables like 'datadir',可查看真正的data目录 原文:http://blog.csdn.net/dmz1981/ ...

  5. 黄聪:wordpress/wp-includes目录文件

    wp-includes/cache.php wp-includes/capabilities.php wp-includes/class-IXR.php:Incutio XML-RPC库.包括了 XM ...

  6. c# 甘蔗斗地主1.4存档修改器

           using System; using System.Collections.Generic; using System.ComponentModel; using System.Dat ...

  7. [CSS]如何正确使用ID和Class?

    作者:DarkZone链接:https://www.zhihu.com/question/19550864/answer/23440690来源:知乎 以下摘自<精通CSS:高级Web标准解决方案 ...

  8. apache重写规则自动追加查询参数QSA

    看好多大网站上的搜索都是以.html?keyword=手机&page=abc这个样子表现, 如: search_goods.html?q=%BF%D5%C6%F8%BE%BB%BB%AF%C6 ...

  9. Java Cookie和Session(转载)

    一.cookie机制和session机制的区别 具体来说cookie机制采用的是在客户端保持状态的方案,而session机制采用的是在服务器端保持状态的方案. 同时我们也看到,由于才服务器端保持状态的 ...

  10. 配置FileZilla Ftp服务器

    FileZilla是我比较喜欢用的一款FTP服务端和客户端,主要使用在Windows下,她是一款开源的FTP软件,虽然在某些功能上比不上收费软件Ser-u,但她也是一款非常好用的软件,这里主要说一下这 ...