提交时间:2021-12-13 13:41:43

运行 ID: 35117

#include <bits/stdc++.h> using namespace std; pair<int,int>b[8005]; int n,q,a[8005]; int main() { cin >> n >> q; for (int i = 1; i <= n; ++i) { cin >> a[i]; b[i] = {a[i],i}; } stable_sort(b + 1,b + n + 1); for (int i = 1,c,x,y; i <= q; ++i) { cin >> c; if (c == 1) { cin >> x >> y; a[x] = lower_bound(b + 1,b + n + 1,make_pair(a[x],x))->first=v; stable_sort(b + 1,b + n + 1); } else { cin >> x; cout << lower_bound(b + 1,b + n + 1,make_pair(a[x],x))-&b[0] << endl; } } return 0; }