代码样例过了,叫上去全部RE。
代码如下:
#include<bits/stdc++.h>
#define maxint 2147483647
#define int long long
#define ull unsigned long long
using namespace std;
int flag, x, y, n, m, a[1005], maxx, id;
vector <int> cnt(1005);
signed main(){
ios::sync_with_stdio(false), cin.tie(0);
cin >> n >> m;
for(int i = 1; i <= n; i ++) cin >> a[i];
while(m --){
maxx = 0;
cin >> flag >> x >> y;
if(flag){
a[x] = y;
}else{
cnt.clear();
for(int i = x; i <= y; i ++)
cnt[a[i]] ++;
for(; x <= y; x ++){
if(cnt[x] && cnt[x] > maxx)
maxx = cnt[x], id = x;
}
cout << id << '\n';
}
}
return 0;
}