4WA,没有RE和MLE,HELP!
查看原帖
4WA,没有RE和MLE,HELP!
1005753
sxjsxj楼主2023/10/16 22:01
#include<iostream>
using namespace std;
bool f;
int i,n,q,cnt=0,top,x1,y1,x[100001],y[100001];
long long z[100001];
main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);cout.tie(0);
    cin>>n>>q;
    while(q--)
    {
    	cin>>top>>x1>>y1;
    	if(top==1)
    	{
    		cnt++;
    		cin>>z[cnt];
    		x[cnt]=x1,y[cnt]=y1;
		}
		else
		{
			f=false; 
			for(i=1;i<=cnt;i++)
				if(x[i]==x1 && y[i]==y1)
				{
					cout<<z[i]<<'\n';
					f=true;
					break;
				}
			if(!f)
				cout<<"0\n";
		}
	}
}
2023/10/16 22:01
加载中...