RT,是代码时间复杂度太高了导致UKE了吗?
#include <bits/stdc++.h>
using namespace std;
int a[100001];
inline long long read (void)
{
long long s = 0 , f = 1;
char c = getchar ();
while (c < '0' || c > '9')
{
if (c == '-') f = -1;
c = getchar ();
}
while (c >= '0' && c <= '9')
{
s = (s << 1) + (s << 3) + (c ^ 48);
c = getchar ();
}
return s * f;
}
inline void write (long long x)
{
if (x < 0)
{
x = -x;
putchar ('-');
}
if (x > 9) write (x / 10);
putchar (x % 10 + 48);
}
int main (void)
{
int n = read () , m = read () , op , l , r , x;
a[1] = read ();
long long sum = 0;
for (register int i = 2; i <= n; ++i) a[i] = read ();
for (register int i = 1; i <= m; ++i)
{
op = read () , l = read () , r = read () , x = read ();
if (op == 1)
{
for (register int j = l; j <= r; j++)
{
a[j] > x ? a[j] -= x : true;
}
}
else
{
sum = 0;
for (register int j = l; j <= r; j++)
{
a[j] == x ? sum++ : true;
}
write (sum);
putchar ('\n');
}
}
return 0;
}