Submission #878671

#TimeUsernameProblemLanguageResultExecution timeMemory
878671Jawad_Akbar_JJSure Bet (CEOI17_sure)C++17
60 / 100
22 ms32120 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...