Submission #878671

# Submission time Handle Problem Language Result Execution time Memory
878671 2023-11-25T04:24:59 Z Jawad_Akbar_JJ Sure Bet (CEOI17_sure) C++17
60 / 100
22 ms 32120 KB
#include <iostream>
#include <vector>
#include <iomanip>
 
using namespace std;
#define ld long double 
const int N = 1e3  + 10;
vector<int> v;
ld a[N];
ld b[N];
int n;
ld ans = 0;

ld dp1[N][N];
ld dp2[N][N];

signed main(){
	cout<<fixed<<setprecision(4);
	cin>>n;
	
	for (int i=1;i<=n;i++)
		cin>>a[i]>>b[i];
	
	for (int i=1;i<=n;i++)
		for (int j=1;j<=n;j++)
			dp1[i][j] = max(dp1[i-1][j],dp1[i-1][j-1] + a[i] - 1);
			
	for (int i=1;i<=n;i++)
		for (int j=1;j<=n;j++)
			dp2[i][j] = max(dp2[i-1][j],dp2[i-1][j-1] + b[i] - 1);
	
	for (int i=1;i<=n;i++)
		for (int j=1;j<=n;j++)
			ans = max(ans,min(dp1[n][i] - j, dp2[n][j] - i));
	cout<<ans<<endl;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 2 ms 4700 KB Output is correct
8 Correct 1 ms 4700 KB Output is correct
9 Correct 1 ms 4700 KB Output is correct
10 Correct 1 ms 4700 KB Output is correct
11 Correct 2 ms 4700 KB Output is correct
12 Correct 22 ms 32116 KB Output is correct
13 Correct 19 ms 31920 KB Output is correct
14 Correct 19 ms 32112 KB Output is correct
15 Correct 19 ms 32120 KB Output is correct
16 Correct 19 ms 32088 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 2 ms 4700 KB Output is correct
8 Correct 1 ms 4700 KB Output is correct
9 Correct 1 ms 4700 KB Output is correct
10 Correct 1 ms 4700 KB Output is correct
11 Correct 2 ms 4700 KB Output is correct
12 Correct 22 ms 32116 KB Output is correct
13 Correct 19 ms 31920 KB Output is correct
14 Correct 19 ms 32112 KB Output is correct
15 Correct 19 ms 32120 KB Output is correct
16 Correct 19 ms 32088 KB Output is correct
17 Runtime error 2 ms 604 KB Execution killed with signal 11
18 Halted 0 ms 0 KB -