38 lines
778 B
C++
38 lines
778 B
C++
// The question want me to impl a sort by my self
|
|
// But absolutely not
|
|
|
|
#include <iostream>
|
|
|
|
using namespace std;
|
|
|
|
int main() {
|
|
int n, Q;
|
|
cin >> n >> Q;
|
|
int arr[n + 5];
|
|
|
|
for (int i = 1; i <= n; i++) {
|
|
cin >> arr[i];
|
|
}
|
|
|
|
for (int i = 0; i < Q; i++) {
|
|
int op;
|
|
cin >> op;
|
|
if (op == 1) {
|
|
int x, v;
|
|
cin >> x >> v;
|
|
arr[x] = v;
|
|
} else {
|
|
int xn;
|
|
cin >> xn;
|
|
int it = arr[xn];
|
|
int pos = n;
|
|
for (int j = 1; j < xn; j++) {
|
|
if (arr[j] > it) pos--;
|
|
}
|
|
for (int j = xn + 1; j <= n; j++) {
|
|
if (arr[j] >= it) pos--;
|
|
}
|
|
cout << pos << endl;
|
|
}
|
|
}
|
|
} |