This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
int main() {
int N, M;
cin >> N >> M;
vector<int> h(N);
for (int &value : h) {
cin >> value;
}
while (M--) {
int type;
cin >> type;
if (type == 1) {
int pos, val;
cin >> pos >> val;
h[--pos] = val;
} else {
int H;
cin >> H;
int answer = 0;
for (int i = 0; i < N - 1; i++) {
if (h[i] < h[i + 1]) {
answer += h[i] <= H && H <= h[i + 1];
} else {
answer += h[i + 1] <= H && H <= h[i];
}
}
cout << answer << "\n";
}
}
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |