本题我之前尝试用过vector,但是内存会超,所以用了map就过了
注意二维map的写法
map<int,map<int,int>> mp
map<a,map<b,c>> mp;
会创立一个mp[b][c] = a;的数组,其中a,b,c为数据类型
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
const int N = 1e5 + 10;
int main(){
	ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
	int n,q;
	cin >> n >> q;
	map<int,map<int,int>> mp;
	int a,b,c,d;
	for(int i = 1; i <= q; i++){
		cin >> a >> b >> c;
		if(a == 1) {cin >> d, mp[b][c] = d;}
		if(a == 2) cout << mp[b][c] << '\n';
	}
	return 0;
} 
                














![[wp]“古剑山”第一届全国大学生网络攻防大赛 Web部分wp](https://img-blog.csdnimg.cn/direct/d2ab34b3fe9040688439f2b8722d6d0b.png)



