이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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... |