分析
数据量很小!就不需要多的思考!暴力狠狠暴力!直接模拟就行啦!
代码
#include "bits/stdc++.h" using namespace std; #define int long long #define endl "\n" #define PII pair<int,int> #define PIII pair<int,PII> const int MOD = 1e9 + 7; const int N = 3e5; void slu() { int n, m; cin >> n >> m; vector<int> a(n); for (int i = 0; i < n; i++)cin >> a[i]; while (m--) { int chose, i, x; cin >> chose >> i >> x; if (chose == 1) { i--; a[i] = x; } else { int cnt = 0; for (int j = 0; j < i; j++)if (a[j] == x)cnt++; cout << cnt << endl; } } } signed main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int T; // cin >> T; T = 1; while (T--)slu(); }