| 比赛 |
2026.9.5 |
评测结果 |
AATTTTTTTTTTTTT |
| 题目名称 |
To-Do List |
最终得分 |
12 |
| 用户昵称 |
Ruyi |
运行时间 |
67.119 s |
| 代码语言 |
C++ |
内存使用 |
4.29 MiB |
| 提交时间 |
2026-09-05 10:28:04 |
显示代码纯文本
#include<bits/stdc++.h>
#define ll long long
#define N 1000001
#define mod 1000003
using namespace std;
ll q,x,y,last,vis[N],cnt;
char op;
map<pair<ll,ll>,ll> mp;
priority_queue<pair<ll,ll>,vector<pair<ll,ll>>,greater<pair<ll,ll>>> pq,pq2;
ll read(){
ll x=0,f=1;
char c=' ';
while(c>'9'||c<'0'){
if(c=='-') f=-1;
c=getchar();
}
while(c>='0'&&c<='9'){
x=x*10+(c-'0');
c=getchar();
}
return x*f;
}
void write(ll x){
if(x<0){
putchar('-');
x=-x;
}
if(x>9) write(x/10);
putchar(x%10+'0');
return ;
}
int main(){
freopen("List.in","r",stdin);
freopen("List.out","w",stdout);
q=read();
while(q--){
op=getchar();
x=(read()+last)%mod;
if(op=='A'){
y=(read()+last)%mod;
pq.push({x,y});
mp[{x,y}]=++cnt;
}else vis[x]=1;
last=0;
while(pq.size()){
if(vis[mp[pq.top()]]==0) last=max(last,pq.top().first-1)+pq.top().second;
pq2.push(pq.top());
pq.pop();
}
while(pq2.size()){
pq.push(pq2.top());
pq2.pop();
}
write(last);
putchar('\n');
}
return 0;
}