lianqiblack @ 2023-10-20 15:11:05
#include<iostream>
using namespace std;
long long b[10005];
int cnt = 0;
typedef struct Elem {
long long a[10005];
}Elem;
typedef struct Sqg {
Elem* s;
int length;
}Sqg;
void Lizi(Sqg& L,int n) {
L.s = new Elem[n];
L.length = 0;
}
void add(Sqg& L,int n1,int n2,long long n3) {
L.s[n1].a[n2] = n3;
}
void Sreach(Sqg& L, int n1, int n2) {
if(L.s[n1].a[n2])
b[cnt++] = L.s[n1].a[n2];
}
void solve_3616() {
int n, m;
cin >> n >> m;
Sqg L;
Lizi(L, n);
while (m--) {
int i=0;
int n1=0, n2=0;
long long n3=0;
cin >> i;
if (i == 1) {
cin >> n1 >> n2 >> n3;
add(L, n1, n2, n3);
}
if (i == 2) {
cin >> n1 >> n2;
Sreach(L, n1, n2);
}
}
}
int main() {
solve_3616();
for (int j = 0; j < cnt; j++) {
cout << b[j] << endl;
}
return 0;
}
by Beacon_wolf @ 2023-11-11 16:38:36
@lianqiblack 这题要用动态数组 vector