QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#818751#9879. ReTravelkkkgjyismine4WA 1ms5640kbC++20629b2024-12-18 08:17:212024-12-18 08:17:22

Judging History

This is the latest submission verdict.

  • [2024-12-18 08:17:22]
  • Judged
  • Verdict: WA
  • Time: 1ms
  • Memory: 5640kb
  • [2024-12-18 08:17:21]
  • Submitted

answer

#include<bits/stdc++.h>
#define ll long long
#define N 505
using namespace std;
const ll inf=1e18;
int px[N],py[N],n;
ll f[N][N],mn[N][N];
int main(){
	ios::sync_with_stdio(0);
	cin>>n;
	for(int i=1;i<=n;++i)cin>>px[i]>>py[i];
	for(int i=1;i<=n;++i){
		int mnx=1e9,mny=1e9;
		for(int j=i;j<=n;++j){
			mnx=min(mnx,px[j]),mny=min(mny,py[j]);
			mn[i][j]=1ll*mnx+1ll*mny,f[i][j]=inf;
		}
	}
	for(int i=n;i;--i)
		for(int j=i;j<=n;++j){
			if(i==j)continue;f[i][j]=inf;
			for(int k=i;k<j;++k)f[i][j]=min(f[i][j],f[i][k]+f[k+1][j]+mn[i][k]+mn[k+1][j]-2ll*mn[i][j]);
		}
	cout<<f[1][n]+mn[1][n];
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

2
3 3
1 2

output:

1000000000000000003

result:

wrong answer 1st words differ - expected: '6', found: '1000000000000000003'