卡常求助!! UKE
查看原帖
卡常求助!! UKE
748239
OIbishop楼主2022/11/7 23:03
#include <bits/stdc++.h>
#pragma comment(linker,"/stack:200000000")
#pragma GCC optimize("Ofast,no-stack-protector")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
long long a[100001];
inline long long read ()
{
	register 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 ()
{
	int n = read () , m = read () , op , l , r , x; 
	long long sum = 0;
	for (register int i = 1; 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;
} 
2022/11/7 23:03
加载中...