yangCode01 @ 2022-04-12 17:00:56
import java.util.*;
// 1:无需package
// 2: 类名必须Main, 不可修改
public class Main {
//static int[][] arr=new int[100010][100010];
static ArrayList<ArrayList<A>> arr=new ArrayList<>();
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
//在此输入您的代码...
int n= scan.nextInt();
int m= scan.nextInt();
while(m-->0){
ArrayList<A> a=new ArrayList<>();
int choice=scan.nextInt();
int i= scan.nextInt();
int j= scan.nextInt();
if(choice==1){
int val= scan.nextInt();
a.add(new A(i,j,val));
arr.add(a);
}else {
int flag=0;
for(int ii=0;ii<arr.size();ii++){if(flag==1)
break;
for(int jj=0;jj<arr.get(ii).size();jj++){
if(arr.get(ii).get(jj).i==i&&arr.get(ii).get(jj).j==j){
System.out.println(arr.get(ii).get(jj).val);
flag=1;
break;
}
}
}
}
}
scan.close();
}
}
class A{
int i;
int j;
int val;
public A(int i, int j, int val) {
this.i = i;
this.j = j;
this.val = val;
}
public A(int i, int j) {
this.i = i;
this.j = j;
}
}
by 17628038004czy @ 2022-06-08 10:34:10
k==0的时候直接删除,查询到的时候返回null就行