Run ID 作者 问题 语言 测评结果 时间 内存 代码长度 提交时间
77660 sh25_shenpy 公交换乘 C++ 通过 55 MS 636 KB 588 2025-12-26 14:36:56

Tests(20/20):


#include<bits/stdc++.h> using namespace std; struct node{ bool ty; int p, t; }qu[100010]; int f, b = 1; int n; int main(){ int ans = 0; cin >> n; for(int i = 1; i <= n; i++){ int a, bb, c; cin >> a >> bb >> c; node aa = {(bool)a, bb, c}; if (aa.ty){ bool flag = 0; for(int j = b; j <= f; j++) if(aa.t - qu[j].t <= 45){ if(aa.p<=qu[j].p){ flag = 1; qu[j].p = 0; break; } } else b = j; if (!flag) ans += aa.p; } else{ ans += aa.p; qu[++f] = aa; } } cout << ans; return 0; }


测评信息: