比赛 2026.9.5 评测结果 AATTTTTTTTATTTT
题目名称 To-Do List 最终得分 19
用户昵称 KKZH 运行时间 61.605 s
代码语言 C++ 内存使用 5.57 MiB
提交时间 2026-09-05 11:32:38
显示代码纯文本
#include <bits/stdc++.h> 
using namespace std;
#define int long long
const int N=1e6+10;
const int mod=1e6+3;
struct node{
    int s,t,id;
    friend bool operator<(node a1,node a2){
        if(a1.s==a2.s) return a1.id<a2.id;
        return a1.s<a2.s;
    }
}a[N];
int n,cnt;
set <node> st;
signed main(){
//    freopen("s5.2-21.in","r",stdin);
    freopen("List.in","r",stdin);
    freopen("List.out","w",stdout);
    ios::sync_with_stdio(false);
    cin.tie(0),cout.tie(0);
    cin>>n;
    int las=0;
    char x;
    for(int i=1;i<=n;i++){
        cin>>x;
        if(x=='A'){
            ++cnt;
            cin>>a[cnt].s>>a[cnt].t;
            a[cnt].s=(a[cnt].s+las)%mod;
            a[cnt].t=(a[cnt].t+las)%mod;
            a[cnt].id=cnt;
            a[cnt].s--;
            st.insert(a[cnt]);
//            cout<<a[cnt].s<<"  "<<a[cnt].t<<' '<<a[cnt].id<<' '<<st.size()<<'\n';
        }else{
            int o;
            cin>>o;
            o=(o+las)%mod;
            st.erase(a[o]);
        }
        int now=0;
        for(auto j:st){
            now=max(now,j.s);
            now+=j.t;
        }
        cout<<now<<'\n';
        las=now;
    }
}