| 比赛 |
2026.9.5 |
评测结果 |
EETTTTTTETEEETT |
| 题目名称 |
To-Do List |
最终得分 |
0 |
| 用户昵称 |
杨蕙宇 |
运行时间 |
46.821 s |
| 代码语言 |
C++ |
内存使用 |
3.57 MiB |
| 提交时间 |
2026-09-05 12:14:58 |
显示代码纯文本
#include<bits/stdc++.h>
using namespace std;
const int N=1e6+10;
const int p=1e6+3;
struct node{
int id,s,t,mk;
};
vector<node>v;
int q;
int tot;
bool cmp(node x,node y){
return x.s<y.s;
}
int last=0;
int 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--){
int ans=0;
int pre=0;
char op;
int s,t,x;
cin>>op;
if(op=='A'){
cin>>s>>t;
s=(s+last)%p;
t=(t+last)%p;
v.push_back({tot++,s,t,0});
}
else{
cin>>x;
x=(x+last)%p;
v[x].mk=1;
}
sort(v.begin(),v.end(),cmp);
for(int i=0;i<v.size();i++){
int mk=v[i].mk;
if(mk)continue;
int s=v[i].s;
int t=v[i].t;
if(s<=pre){
ans+=t;
pre+=t;
}
else{
ans+=(s-pre+t-1);
pre=(s+t-1);
}
}
cout<<ans<<"\n";
last=ans;
}
return 0;
}