1 条题解
-
0
#include <bits/stdc++.h> //#define int long long using namespace std; int n,k,ans; struct metro { int price; long long time; } a[100001]; int main() { int choose=1; bool p=false; cin>>n; for (int i=1;i<=n;i++) { int su,pr,ti; cin>>su>>pr>>ti; if (su==0) {//乘坐地铁的时候 ans=ans+pr; a[++k].price=pr; a[k].time=ti; } else {//乘坐公交车的时候 p=false; for (int j=choose;j<=k;j++) {//选择票 if (ti-a[j].time>45) { choose=j+1; continue; } if (a[j].price>=pr) { p=true; a[j].price=0; break; } } if (!p) ans=ans+pr; } } cout<<ans; return 0; }
- 1
信息
- ID
- 477
- 时间
- 1000ms
- 内存
- 256MiB
- 难度
- 3
- 标签
- (无)
- 递交数
- 24
- 已通过
- 20
- 上传者