Information
- ID
- 5770
- Time
- 3000ms
- Memory
- 512MiB
- Difficulty
- 10
- Tags
- # Submissions
- 18
- Accepted
- 4
- Uploaded By
臭名昭著名声远扬的题
直接模拟+火车头+指令集快读即可,思路无需说明。
#include<bits/stdc++.h>
#define For(i,l,r) for(register int i = l;i <= r;i++)
#pragma comment(linker,"/stack:200000000")
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC diagnostic error "-std=c++14"
using namespace std;
int n,m,a[100100];
static char buf[1000100],*p1 = buf,*p2 = buf;
#define getchar() p1 == p2 && (p2 = (p1 = buf) + fread(buf,1,1000000,stdin),p1 == p2) ? EOF : *p1++
inline int read(){
register int x = 0;
register char ch = getchar();
while(ch < '0' || ch > '9'){
ch = getchar();
}
while(ch >= '0' && ch <= '9'){
x = (x << 1) + (x << 3) + (ch ^ 48);
ch = getchar();
}
return x;
}
int main(){
ios::sync_with_stdio(false);
cout.tie(0);
n = read(),m = read();
For(i,1,n){
a[i] = read();
}
For(d,1,m){
register int o = read(),l = read(),r = read(),x = read();
if(o == 1){
For(i,l,r){
a[i] -= (a[i] > x) ? x : 0;
}
}
if(o == 2){
register int ans = 0;
For(i,l,r){
ans += !(a[i] - x);
}
cout<<ans<<'\n';
}
}
return 0;
}
By signing up a HFOJ universal account, you can submit code and join discussions in all online judging services provided by us.