Submission #681489

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
6814892023-01-13 07:23:07niannyLet's Win the Election (JOI22_ho_t3)C++17
0 / 100
912 ms996552 KiB
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define hallo ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define endl '\n'
int n, k;
double memo[507][507][507];
// int A[507],B[507];
pair<int,int>arr[507];
double dp(int index, int k, int collab){
if(memo[index][k][collab] > 0) return memo[index][k][collab];
if (k == 0) return memo[index][k][collab] = 0;
if (index >= n) return memo[index][k][collab]=1e18;
if (arr[index].second == -1){
return memo[index][k][collab] = min({dp(index+1, k, collab), dp(index+1, k-1, collab) + arr[index].first});
}
return memo[index][k][collab] = min({dp(index+1, k, collab), dp(index+1, k-1, collab) + arr[index].first, dp(index+1, k-1, collab+1)*collab/(collab+1)+arr[index].second});
}
int32_t main() {
// ifstream cin("addin.txt");
// ofstream cout("addout.txt");
hallo;
cin>>n>>k;
for(int i = 0; i < n; i++){
int a,b;
cin>>a>>b;
arr[i] = {a,b};
 
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...