QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#724462#9581. 都市叠高wsxcbWA 558ms4172kbC++17773b2024-11-08 13:15:062024-11-08 13:15:07

Judging History

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

  • [2024-11-08 13:15:07]
  • 评测
  • 测评结果:WA
  • 用时:558ms
  • 内存:4172kb
  • [2024-11-08 13:15:06]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define fi first
#define se second
typedef vector<vector<ll>> Mat;
#define int long long
const int N=5e3+10,mod=1e9+7,inf=1e9+1,P=998244353;
const double pi=acos(-1.0),esp=1e-9;
const ll INF=1e18;
long double x[N],y[N];
long double dp[N];
long double dis(int i,int j){
	return hypot(x[i]-x[j],y[i]-y[j]);
}
void solve()
{
	int n;
	cin>>n;
	for(int i=1;i<=n;i++){
		cin>>x[i]>>y[i];
		for(int j=1;j<i;j++){
			dp[i]=max(dp[i],dp[j-1]+dis(i,j));
		}
	}
	cout<<fixed<<setprecision(12)<<dp[n]<<'\n';
}
signed main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);cout.tie(0);
    int t=1;
    //cin>>t;
    while(t--)
        solve();
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 3964kb

input:

7
1 0
0 1
0 0
1 1
1 2
3 2
3 3

output:

5.656854249492

result:

ok found '5.6568542', expected '5.6568542', error '0.0000000'

Test #2:

score: -100
Wrong Answer
time: 558ms
memory: 4172kb

input:

4741
583042625 -288151442
901234470 -999760464
-974135773 -819820344
562644007 892707743
-120734580 -288167839
-14369253 88358276
-150949453 -39424771
-947214734 -826830020
578141361 443534304
-783950948 394211236
861595911 -751206580
570425640 624990919
484450011 -470115909
-417437663 22205205
-278...

output:

2771137091259.800319194794

result:

wrong answer 1st numbers differ - expected: '2798587991989.8847656', found: '2771137091259.8002930', error = '0.0098088'