这个数据太卡大小了
vector<vector> s(n + 10, vector(m + 10, 0));
#include <bits/stdc++.h>
#define int long long
using namespace std;
signed main()
{
int n, m, q;
cin >> n >> m >> q;
vector<vector<int>> s(n + 10, vector<int>(m + 10, 0));
for(int i = 1; i <= n; i ++ )
for(int j = 1; j <= m; j ++ )
cin >> s[i][j];
for(int i = 1; i <= n; i ++ )
for(int j = 1; j <= m; j ++ )
s[i][j] += s[i][j - 1] + s[i - 1][j] - s[i - 1][j - 1];
while(q -- )
{
int x1, y1, x2, y2;
cin >> x1 >> y1 >> x2 >> y2;
cout << s[x2][y2] - s[x1 - 1][y2] - s[x2][y1 - 1] + s[x1 - 1][y1 - 1] << endl;
}
}

deque
滑动窗口的感觉
#include <bits/stdc++.h>
#define int long long
using namespace std;
const int N = 1e5 + 10;
int n, k;
map<string, int> cnt;
string a[N];
signed main()
{
cin >>n >> k;
for(int i = 1; i <= n; i ++ ) cin >> a[i];
int res = 0, l = 1;
for(int i = 1; i <= n; i ++ )
{
while(i - l - 1 > k) cnt[a[l ++ ]] -- ;
res += cnt[a[i]];
cnt[a[i]] ++ ;
}
cout << res <<endl;
return 0;
}

对顶堆的知识
必须得想好将中位数放在哪个位置
#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 10;
int n;
int a[N];
priority_queue<int> down;
priority_queue<int, vector<int>, greater<int>> up;
void run()
{
cin >>n;
for(int i = 1; i <= n; i ++ ) cin >>a[i];
// for(int i = 1; i <= n; i ++ ) cout << a[i] <<' ';
// cout <<endl;
while(up.size()) up.pop();
while(down.size()) down.pop();
for(int i = 1; i <= n; i ++ )
{
int x = a[i];
if(up.empty()) up.push(x);
else if(x > up.top()) up.push(x);
else down.push(x);
if(up.size() > down.size() + 1) down.push(up.top()), up.pop();
if(up.size() < down.size()) up.push(down.top()), down.pop();
if(i & 1)
{
cout << up.top() << ' ';
}
}
cout <<endl;
}
int main()
{
int T;
cin >> T;
while(T -- ) run();
return 0;
}
#include <bits/stdc++.h>
#define int long long
using namespace std;
const int N = 1e5 + 10;
int n, m;
string a[N];
map<string, int> q;
signed main()
{
cin >> n >> m;
for(int i = 0; i < n; i ++ )
{
cin >> a[i];
for(auto &b : a[i])
{
if(b <= 'Z' && b >= 'A') b += 32;
else b -= 32;
}
q[a[i]] += 1;
}
for(int i = 0; i < m; i ++ )
{
string t;
cin >> t;
cout << q[t] <<endl;
}
return 0;
}