This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
//izho17_2A
#include <bits/stdc++.h>
#define int long long
const int maxn = 1e6+1;
using namespace std;
int a[maxn], n, m, heights[maxn];
//int op(int u, int v) {
// return ;
//}
/*int get(int v = 1, int tl = 1, int tr = n, int h) {
if (l > tr || tl > r) return 0;
if (l <= tl && tr <= r) return tree[v];
int mid = tl+tr>>1;
return get(v*2,tl,mid,h)+get(v*2+1,mid+1,tr,h);
}
void build(int v = 1, int tl = 1, int tr = n) {
if (tl==tr) {
tree[v]=a[tl]; return;
} int mid = tl+tr>>1;
build(v*2,tl,mid); build(v*2+1,mid+1,tr);
tree[v]=op(tree[v*2],tree[v*2+1]);
.
}*/
signed main() {
cin >> n >> m;
for (int i = 1; i <= n; i++) cin >> a[i];
for (;m--;) {
int k; cin >> k;
if (k-1) {
int c; cin >> c; int cnt = 0;
for (int i = 2; i <= n; i++) {
cnt += ((a[i]>=c && a[i-1]<=c) || (a[i]<=c && a[i-1]>=c));
} cout << cnt << '\n';
} else {
int pos, val; cin >> pos >> val;
a[pos]=val;
}
}
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |