QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#359449 | #6517. Computational Geometry | Doqe | WA | 2ms | 3804kb | C++14 | 699b | 2024-03-20 17:56:31 | 2024-03-20 17:56:31 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
const int N=1e4+10;
long long W[N][N];
int x[N],y[N];
long long abs(int i,int j)
{
return 1ll*(x[i]-x[j])*(x[i]-x[j])+1ll*(y[i]-y[j])*(y[i]-y[j]);
}
int main()
{
int T;cin>>T;
int U=(T<=10),C=0;
while(T--)
{
int n;cin>>n;
for(int i=1;i<=n;++i)cin>>x[i]>>y[i],x[n+i]=x[i],y[n+i]=y[i];
if(++C==120)
{
for(int i=1;i<=n;++i)cout<<x[i]<<" "<<y[i]<<endl;
}
long long ans=8e18;
for(int d=2;d<=n+1;++d)
for(int i=1,j=d;j<=n*2;++i,++j)
W[i][j]=max({W[i][j-1],W[i+1][j],abs(i,j)});
for(int i=1;i<=n;++i)
for(int j=3;j<=n-1;++j)
ans=min(ans,W[i][i+j-1]+W[i+j-1][i+n]);
if(U)cout<<ans<<endl;
}
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3644kb
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:
4 44
result:
ok 2 number(s): "4 44"
Test #2:
score: -100
Wrong Answer
time: 2ms
memory: 3804kb
input:
713 8 8 25 3 15 0 5 10 0 19 2 24 6 23 15 15 34 8 25 16 18 25 10 32 1 23 0 14 21 0 27 2 32 6 7 16 15 8 20 1 16 0 12 16 0 21 1 24 5 7 15 1 18 0 24 8 27 15 4 19 0 17 7 8 4 10 20 0 30 15 0 14 10 6 15 0 24 10 21 14 12 14 7 11 0 3 7 18 7 16 9 12 10 6 9 0 4 5 0 15 1 9 0 23 8 13 14 6 24 0 34 1 41 11 37 20 1...
output:
0 9 1 2 8 0 15 6 5 14 2 11
result:
wrong answer 1st numbers differ - expected: '1075', found: '0'