#include <bits/stdc++.h>
using namespace std;
using ll = long long;
void solve(){
ll n, m; cin >> n >> m;
vector<ll> v(n);
for(ll i = 0; i < n; ++i){
cin >> v[i];
}
ll ans = 0;
while(m--){
ll pos; cin >> pos;
if(pos == 1){
ll a, b; cin >> a >> b;
for(ll i = 0; i < n; ++i){
if(v[i] == a){
v[i] = b;
break;
}
}
}
else{
ans = 0;
ll k; cin >> k;
for(ll i = 0; i < n - 1; ++i){
if((v[i] <= k && v[i + 1] >= k)||(v[i] >= k && v[i + 1] <= k)){
ans++;
}
}
cout << ans << "\n";
}
}
}
int main() {
solve();
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Incorrect |
3 ms |
348 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Incorrect |
3 ms |
348 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Incorrect |
3 ms |
348 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |