QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#724458#9581. 都市叠高wsxcbWA 182ms4032kbC++17779b2024-11-08 13:14:082024-11-08 13:14:09

Judging History

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

  • [2024-11-08 13:14:09]
  • 评测
  • 测评结果:WA
  • 用时:182ms
  • 内存:4032kb
  • [2024-11-08 13:14:08]
  • 提交

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;
int x[N],y[N];
double dp[N];
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<<dp[i]<<'\n';
	}
	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;
}

詳細信息

Test #1:

score: 100
Accepted
time: 1ms
memory: 3872kb

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: 182ms
memory: 4032kb

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.804199218750

result:

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