• 【USACO 2019 February Bronze】Measuring Traffic 题解


    这是老师放出来的题解:

    Let’s first focus on predicting the range of possible rates of traffic at the end of the highway (past mile N). To do this, we start with a large possible range [a,b] (initially set to [−999999999,+999999999]) and narrow / modify it as we scan through the different highway components from miles 1…N. Every time we see a sensor reading directly from the highway, this clips the possible range [a,b] to the range given by the sensor. Every time we see an on-ramp with range [a′,b′], the new range of possible traffic flows is [a+a′,b+b′]. Similarly, when we see an off-ramp with range [a′,b′], the new range of possible traffic flow values is [a−b′,b−a′] (after this update, we set the lower end of the range to zero if it goes negative, since we can’t have a negative rate of traffic flow).

    Predicting the range of possible initial flows is similar and essentially symmetric, where we scan backwards and keep track of a working range [a,b] that is narrowed / modified appropriately by each highway feature.

    翻译后:
    让我们首先关注预测高速公路末端(N英里)可能的交通量范围。为此,我们从一个较大的可能范围[a,b]开始(最初设置为[-999999999,+999999999]),并在扫描1…N英里的不同高速公路组件时缩小/修改它。每次我们看到传感器直接从高速公路读取数据时,这会将可能的范围[a,b]剪辑到传感器给定的范围。每当我们看到范围为[a′,b′的入口匝道时,可能的交通流的新范围为[a+a′,b+b′。类似地,当我们看到范围为[a′,b′的出口匝道时,可能的交通流值的新范围为[a-b′,b-a′(在这次更新之后,如果范围的下限变为负值,我们将其设置为零,因为我们不能有负的交通流速率)。

    预测可能的初始流量范围是相似的,并且基本上是对称的,我们向后扫描并跟踪一个工作范围[a,b],该工作范围被每个公路特征适当地缩小/修改。

  • 相关阅读:
    第2讲——处理数据
    第1讲——用C++写一个程序
    数论18——反演定理(莫比乌斯反演)
    数论17——反演定理(二项式反演)
    数论16——母函数
    数论15——抽屉原理
    数论14——容斥原理
    数论13——康托展开
    com.opensymphony.xwork2.config.ConfigurationManager.addConfigurationProvider
    Tomcat的杂七杂八
  • 原文地址:https://www.cnblogs.com/2020-zhy-jzoj/p/13159893.html
Copyright © 2020-2023  润新知