답안 #878644

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
878644 2023-11-25T02:56:24 Z Faisal_Saqib Sure Bet (CEOI17_sure) C++17
60 / 100
150 ms 37212 KB
#include <iostream>
#include <vector>
#include <cmath>
#include <iomanip>
using namespace std;
const int N=1001;
double dp[N][N];
double dp1[N][N];
int main()
{
    cout<<fixed<<setprecision(4);
	int n;
	cin>>n;
	vector<double> a,b;
	for(int i=0;i<n;i++)
	{
		double x,y;
		cin>>x>>y;
		a.push_back(x);
		b.push_back(y);
	}
	for(int i=0;i<=n;i++)
		for(int j=0;j<=n;j++)
			dp[i][j]=dp1[i][j]=-1e9;
	dp[0][0]=dp1[0][0]=0;
	for(int i=0;i<n;i++)
	{
		for(int j=0;j<=i;j++)
		{
			dp[i+1][j]=max(dp[i+1][j],dp[i][j]);
			dp[i+1][j+1]=max(dp[i+1][j+1],dp[i][j]+a[i]-1);
			dp1[i+1][j]=max(dp1[i+1][j],dp1[i][j]);
			dp1[i+1][j+1]=max(dp1[i+1][j+1],dp1[i][j]+b[i]-1);
		}
	}
	double ans=0;
	for(int j=0;j<=n;j++)
		for(int i=0;i<=n;i++)
			ans=max(ans,min(dp[n][j]-i,dp1[n][i]-j));
	cout<<ans<<endl;
	return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 2396 KB Output is correct
2 Correct 0 ms 2396 KB Output is correct
3 Correct 0 ms 2396 KB Output is correct
4 Correct 1 ms 2396 KB Output is correct
5 Correct 1 ms 2396 KB Output is correct
6 Correct 1 ms 2396 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 2396 KB Output is correct
2 Correct 0 ms 2396 KB Output is correct
3 Correct 0 ms 2396 KB Output is correct
4 Correct 1 ms 2396 KB Output is correct
5 Correct 1 ms 2396 KB Output is correct
6 Correct 1 ms 2396 KB Output is correct
7 Correct 1 ms 6492 KB Output is correct
8 Correct 1 ms 6588 KB Output is correct
9 Correct 1 ms 6492 KB Output is correct
10 Correct 1 ms 6492 KB Output is correct
11 Correct 1 ms 6492 KB Output is correct
12 Correct 6 ms 16072 KB Output is correct
13 Correct 6 ms 15964 KB Output is correct
14 Correct 6 ms 16064 KB Output is correct
15 Correct 6 ms 16032 KB Output is correct
16 Correct 6 ms 16068 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 2396 KB Output is correct
2 Correct 0 ms 2396 KB Output is correct
3 Correct 0 ms 2396 KB Output is correct
4 Correct 1 ms 2396 KB Output is correct
5 Correct 1 ms 2396 KB Output is correct
6 Correct 1 ms 2396 KB Output is correct
7 Correct 1 ms 6492 KB Output is correct
8 Correct 1 ms 6588 KB Output is correct
9 Correct 1 ms 6492 KB Output is correct
10 Correct 1 ms 6492 KB Output is correct
11 Correct 1 ms 6492 KB Output is correct
12 Correct 6 ms 16072 KB Output is correct
13 Correct 6 ms 15964 KB Output is correct
14 Correct 6 ms 16064 KB Output is correct
15 Correct 6 ms 16032 KB Output is correct
16 Correct 6 ms 16068 KB Output is correct
17 Runtime error 150 ms 37212 KB Execution killed with signal 11
18 Halted 0 ms 0 KB -