题目链接:https://codeforces.com/gym/101741/problem/D
题目大意:
有这么一部电梯,如果有一群人从floor 0乘坐电梯上楼,电梯先会到达所需的最高楼层释放乘客,然后往下释放,直到回到floor 0.现在知道每个乘客的到达电梯的时间和所要到达的楼层,问怎么安排乘客使传输时间最短。
解题思路:(看图)
代码如下:
# include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn = 2e5 + 5;
ll t[maxn], h[maxn], dp[maxn];
typedef pair <ll, int> P;
priority_queue <P, vector<P>, greater<P> > q;
int n;
int main(){
std::ios::sync_with_stdio(false);
while(cin >> n){
ll time, high;
in