Sunnnnnn @ 2024-07-20 22:41:24
#include<bits/stdc++.h>
using namespace std;
const int MOD=1004;
struct node{
int i1,j1,k1;
};
vector<node>a[1005][1005];
int main(){
int n,q,opt,i,j,k;
cin>>n>>q;
while(q--){
cin>>opt;
if(opt==1){cin>>i>>j>>k;a[i%MOD][j%MOD].push_back(node{i,j,k});}
if(opt==2){
cin>>i>>j;
for(int u=0;u<=a[i%MOD][j%MOD].size();u++){
if(a[i%MOD][j%MOD][u].i1==i&&a[i%MOD][j%MOD][u].j1==j)cout<<a[i%MOD][j%MOD][u].k1<<"\n";
}
}
}
return 0;
}
by o1__1o @ 2024-08-03 11:41:07
用map
by Laugh_at_the_sky @ 2024-08-11 11:23:14
用 map,数组会炸
by Laugh_at_the_sky @ 2024-08-11 11:23:25
@Sunnnnnn