链接:https://codeforces.com/contest/1237/problem/B
Consider a tunnel on a one-way road. During a particular day, nn cars numbered from 11 to nn entered and exited the tunnel exactly once. All the cars passed through the tunnel at constant speeds.
A traffic enforcement camera is mounted at the tunnel entrance. Another traffic enforcement camera is mounted at the tunnel exit. Perfectly balanced.
Thanks to the cameras, the order in which the cars entered and exited the tunnel is known. No two cars entered or exited at the same time.
Traffic regulations prohibit overtaking inside the tunnel. If car ii overtakes any other car jj inside the tunnel, car ii must be fined. However, each car can be fined at most once.
Formally, let's say that car ii definitely overtook car jj if car ii&nb

这是一个关于交通管理的问题,隧道内禁止超车。已知每辆车进入和离开隧道的顺序,需要找出违反规定的车辆数量。通过比较进出隧道的顺序可以确定超车情况。题目提供了一些示例并指出可以使用简单的遍历方法解决,而不是复杂的数据结构如线段树。
最低0.47元/天 解锁文章
786

被折叠的 条评论
为什么被折叠?



