操作2是什么意思
为什么不能直接模拟啊
为什么要用线段树啊
#include <bits/stdc++.h>
#define rei register int
#define LL long long
#define IOS ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define cvar int n, m, T;
#define rep(i, s, n, c) for (register int i = s; i <= n; i+=c)
#define repd(i, s, n, c) for (register int i = s; i >= n; i-=c)
#define CHECK cout<<"WALKED"<<endl;
inline int read(){int x=0,f=1;char ch=getchar();while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();} while(ch>='0' && ch<='9')x=(x<<3)+(x<<1)+ch-'0',ch=getchar();return x*f;}
#define pb push_back
#define ls id<<1
#define rs id<<1|1
const int INF = INT_MAX;
long long binpow(long long a, long long b, LL mod){long long res = 1; while (b > 0){if (b & 1) res = res * a % mod;a = a * a % mod; b >>= 1; } return res;}
using namespace std;
int Q,M,op,v;
vector<int>a;
int main()
{
int T;
cin>>T;
int x=1;
while(T--)
{
Q = read(), M = read();
while (Q--)
{
op = read(), v = read();
a.pb(v);
if (op == 1)
{
x = x * v % M;
printf("%d\n", x);
}
else
{
x = x / a[v-1];
x %= M;
printf("%d\n", x);
}
}
}
return 0;
}