数据太水了
查看原帖
数据太水了
381864
mousezzk楼主2023/9/9 20:39

我的代码无无解特判甚至样例2都没过就AC了

#include<bits/stdc++.h>
using namespace std;
const int N=1e5+5;
int n,k,x,y,heng[N],shu[N],zxy[N],yxy[N],ans,zyx[N],yyx[N];
int main(){
	scanf("%d%d",&n,&k);
	for(int i=1;i<=n;i++){
		scanf("%d%d",&x,&y);
		ans++;
		heng[y]++;
		shu[x]++;
		if(x>=y){
			zxy[x-y]++;
			yxy[x+y]++;
			if(zxy[x-y]==k){
				cout<<ans;
				return 0;
			}
			if(yxy[x+y]==k){
				cout<<ans;
				return 0;
			}
		}
		if(x<=y){
			zyx[y-x]++;
			if(zyx[y-x]==k){
				cout<<ans;
				return 0;
			}
		}
		if(heng[y]==k){
			cout<<ans;
			return 0;
		}
		if(shu[x]==k){
			cout<<ans;
			return 0;
		}
	}
	return 0;
}
2023/9/9 20:39
加载中...