提交时间:2021-12-10 14:09:18

运行 ID: 34252

#include<bits/stdc++.h> using namespace std; int f; int n , q; int a[8050]; int b[8050]; int x , y , z; int main() { cin >> n >> q; for(int i=0; i<n; i++) { cin >> a[i] ; b[i] = a[i] ; } for(int i=0; i<q; i++) { cin >> f ; if(f == 1) { cin >> x >> y ; a[x-1] = y; b[x-1] = y; } if(f == 2) { cin >> x ; sort(a,a+n,greater<int>()); cout << a[x-1] << endl; for(int r=0; r<n; r++) a[r] = b[r]; } } return 0; }