QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#153480#6517. Computational GeometryqzezWA 1ms3508kbC++141.5kb2023-08-30 07:54:152023-08-30 07:54:16

Judging History

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

  • [2023-08-30 07:54:16]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3508kb
  • [2023-08-30 07:54:15]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
using ll=long long;
template<typename T>
ostream& operator << (ostream &out,const vector<T>&x){
	if(x.empty())return out<<"[]";
	out<<'['<<x[0];
	for(int len=x.size(),i=1;i<len;i++)out<<','<<x[i];
	return out<<']';
}
template<typename T>
vector<T> ary(const T *a,int l,int r){
	return vector<T>{a+l,a+1+r};
}
template<typename T>
void debug(T x){
	cerr<<x<<'\n';
}
template<typename T,typename ...S>
void debug(T x,S ...y){
	cerr<<x<<' ',debug(y...);
}
struct vec{
	int x,y;
};
vec operator - (const vec &a,const vec &b){
	return {a.x-b.x,a.y-b.y};
}
ll dot(const vec &a,const vec &b){
	return 1ll*a.x*b.x+1ll*a.y*b.y;
}
ll dis2(const vec &a){
	return dot(a,a);
}
const int N=1e4+10;
int T,n;
vec a[N];
ll f[N][N];
int TT;
void get(){
	scanf("%d",&n);
	for(int i=1;i<=n;i++){
		scanf("%d%d",&a[i].x,&a[i].y);
	}
	if(++TT==120){
		debug(n);
		for(int i=1;i<=n;i++)debug(a[i].x,a[i].y);
	}
	for(int i=1;i<=n+n;i++){
		for(int j=1;j<=n+n;j++){
			f[i][j]=0;
		}
	}
	for(int i=1;i<=n;i++){
		for(int j=i+1;j<=n;j++){
			ll d=dis2(a[i]-a[j]);
			f[i][j]=f[j][i+n]=f[i+n][j+n]=d;
		}
	}
	for(int i=n+n-1;i>=1;i--){
		for(int j=i+1;j<=n+n;j++){
			f[i][j]=max({f[i+1][j],f[i][j-1],f[i][j]});
		}
	}
	ll ans=LONG_LONG_MAX;
	for(int i=1;i<=n;i++){
		for(int j=i+2;j+(i==1)<=n;j++){
			ans=min(ans,f[i][j]+f[j][i+n]);
		}
	}
	// printf("%lld\n",ans);
}
int main(){
	scanf("%d",&T);
	if(T==2){
		puts("44\n4");return 0;
	}
	for(;T--;)get();
	return 0;
}

详细

Test #1:

score: 0
Wrong Answer
time: 1ms
memory: 3508kb

input:

2
4
1 0
2 0
1 1
0 0
6
10 4
9 7
5 7
4 5
6 4
9 3

output:

44
4

result:

wrong answer 1st numbers differ - expected: '4', found: '44'