怎么过的有点懵
查看原帖
怎么过的有点懵
1383979
mndogdied楼主2024/12/13 20:55
#include<bits/stdc++.h>
#define con continue
using namespace std;
int a,m,d,x,n;
int t;
char c;
int tr[200005];
signed main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
	cin>>m>>d;
	while(m--)
	{
		cin>>c>>x;
		if(c=='A')
		{
			tr[++a]=((long long)x+t)%d;
			assert(tr[a]>=0);
		}
		else
		{
			t=0;
			while(x--)
			{
				t=max(t,tr[a-x]);
			}
			cout<<t<<endl;
		}
	}
	return 0;
}
2024/12/13 20:55
加载中...