| 比赛 |
2026.9.5 |
评测结果 |
AAWWWWWWWWWWWWW |
| 题目名称 |
To-Do List |
最终得分 |
12 |
| 用户昵称 |
赵飞羽 |
运行时间 |
0.207 s |
| 代码语言 |
C++ |
内存使用 |
3.63 MiB |
| 提交时间 |
2026-09-05 11:22:58 |
显示代码纯文本
#include <bits/stdc++.h>
#define int long long
using namespace std;
constexpr int N = 1000010, P = 1000003;
int q, ans, lst, n;
struct node{
int x, y;
} a[N], b[N];
bool cmp(node x, node y) {
if (x.x == y.x) return x.y < y.y;
return x.x < y.x;
}
signed main() {
freopen("List.in", "r", stdin);
freopen("List.out", "w", stdout);
ios::sync_with_stdio(0);
cin.tie(0), cout.tie(0);
cin >> q;
if (q <= 3000) {
while (q--) {
char op;
int s, t, x;
cin >> op;
if (op == 'A') {
cin >> s >> t;
s = (s+lst) % P;
t = (t+lst) % P;
a[++n].x = s;
a[n].y = t;
} else if (op == 'D') {
cin >> x;
x = (x+lst) % P;
a[x].x = -1;
a[x].y = 0;
}
for (int i = 1; i <= n; i++) b[i] = a[i];
sort(b+1, b+1+n, cmp);
lst = 0;
for (int i = 1; i <= n; i++) {
lst = max(lst, b[i].x);
lst += b[i].y;
}
lst--;
cout << lst << "\n";
}
} /*else {
while (q--) {
char op;
int s, t;
cin >> op >> s >> t;
s = (s+lst) % P;
t = (t+lst) % P;
a[++n].x = s;
a[n].y = t;
for (int i = 1; i <= n; i++) b[i] = a[i];
sort(b+1, b+1+n, cmp);
lst = 0;
for (int i = 1; i <= n; i++) {
lst = max(lst, b[i].x);
lst += b[i].y;
}
lst--;
cout << lst << "\n";
}
}*/
return 0;
}