QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#794568#1800. Beer VisionI_be_wannaCompile Error//C++20807b2024-11-30 14:57:502024-11-30 14:57:51

Judging History

你现在查看的是最新测评结果

  • [2024-11-30 14:57:51]
  • 评测
  • [2024-11-30 14:57:50]
  • 提交

answer

//j
#include <bits/stdc++.h>
using namespace std;
int ans,n;
bool mark[6004][6004];
//最大向量+-2000,范围2000, 
struct node{
    int x,y;
}e[1004];
bool check(int dx,int dy){
	for(int i=1;i<=n;i++){
		if((!mark[e[i].x+dx][e[i].y+dy])&&(!mark[e[i].x-dx][e[i].y-dy]))return 0;
		//两个方向移动都找不到重合点 
	}
	return 1;
}
bool cmp(node x,node y){
	if(x.x!=y.x)return x.x<y.x;
	else return x.y<y.y;
}
int main(){
    cin>>n;
    for(int i=1;i<=n;i++){
    	cin>>e[i].x>>e[i].y;
    	e[i].x+=3000,e[i].y+=3000;
    	mark[e[i].x][e[i].y]=1;
    	//有负的!!!! 加了向量有还可能是负数 
	}
	sort(e+1,e+1+n,cmp);
	for(int i=2;i<=n;i++){
		int dx=e[i].x-e[1].x;
		int dy=e[i].y-e[1].y;
		if(check(dx,dy))ans+=2;
	}
	cout<<ans;
}

}

Details

answer.code:38:1: error: expected declaration before ‘}’ token
   38 | }
      | ^