比赛 2026.9.5 评测结果 WWTTTTTTTTTTTTT
题目名称 To-Do List 最终得分 0
用户昵称 exil 运行时间 66.504 s
代码语言 C++ 内存使用 5.36 MiB
提交时间 2026-09-05 12:54:40
显示代码纯文本
#include<bits/stdc++.h>
using namespace std;
#define int long long
int s[1000005],t[1000005];
const int mod = 1e6+3;
struct node{
    int l,t;
};
node bian[1000005];
int pan[1000005];
int cnt;
bool cmp(node a,node b){
    return a.l<b.l;
}
signed main(){
    freopen("List.in","r",stdin);
    freopen("List.out","w",stdout);
    
    
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int q;
    cin>>q;
    int ans=0;
    for(int i = 1;i<=q;i++){
        char a;
        cin>>a;
        if(a=='A'){
            int s,t;
            cin>>s>>t;
            cnt++;
            bian[cnt].l=(s+ans)%mod;
            bian[cnt].t=(t+ans)%mod;
            sort(bian+1,bian+1+cnt,cmp);
            int now=0;
            for(int j = 1;j<=cnt;j++){
                if(pan[j]==1)continue;
                if(now>=bian[j].l){
                    now+=bian[j].t;
                }
                else {
                    now=bian[j].t+bian[j].l-1;
                }
            }
            cout<<now<<"\n";
            ans=now;
            
            
            
        }
        else{
            int x;
            cin>>x;
            x=(x+ans)%mod;
            pan[x]=1;
        }
        
        
        
    }
    
    
    
    
    return 0;
}