| 比赛 |
2026.9.5 |
评测结果 |
AATTTTTTTTTTTTT |
| 题目名称 |
To-Do List |
最终得分 |
12 |
| 用户昵称 |
yanglich |
运行时间 |
66.443 s |
| 代码语言 |
C++ |
内存使用 |
3.74 MiB |
| 提交时间 |
2026-09-05 11:53:44 |
显示代码纯文本
#include<bits/stdc++.h>
#define int long long
using namespace std;
int q,cnt,num,last;
const int p=1e6+3;
struct task{
int s,t;
}a[1000006],b[1000006];
bool cmp(task x,task y){
return x.s<y.s;
}
signed main(){
ios::sync_with_stdio(0);
cin.tie(0),cout.tie(0);
freopen("List.in","r",stdin);
freopen("List.out","w",stdout);
cin>>q;
while(q--){
char c;
int x,y;
cin>>c;
if(c=='A'){
cin>>x>>y;
x=(x+last)%p;
y=(y+last)%p;
a[++cnt].s=x;
a[cnt].t=y;
num++;
}
else{
cin>>x;
x=(x+last)%p;
a[x].s=1e18;
num--;
}
for(int i=1;i<=cnt;i++){
b[i]=a[i];
}
sort(b+1,b+cnt+1,cmp);
int ans=0;
for(int i=1;i<=num;i++){
if(ans<b[i].s){
ans=b[i].s;
}
ans+=b[i].t;
}
ans--;
last=ans;
cout<<ans<<"\n";
}
return 0;
}