func_code_string: #include <bits/stdc++.h>   using namespace std;   int n, p, s;   vector<int> v1, v2;   pair<int, pair<int, int>> arr[3005];   bool cmp(pair<int, pair<int, int>> a, pair<int, pair<int, int>> b) {     if (a.second.first == b.second.first)       return a.second.second < b.second.second;     return a.second.first > b.second.first;   }   int dp[3005][3005];   int solve(int x, int taken) {     if (x == n) {       if (taken == p) return 0;       return -1e9;     }     int &ret = dp[x][taken];     if (ret != -1) return ret;     ret = 0;     if (taken < p) {       ret = max(ret, arr[x].second.second + solve(x + 1, taken + 1));     }     int lef = min(s, x - taken);     if (lef < s) {       ret = max(ret, arr[x].second.first + solve(x + 1, taken));     }     ret = max(ret, solve(x + 1, taken));     return ret;   }   void trace(int x, int taken) {     if (x == n) return;     int &ret = dp[x][taken];     if (taken < p && ret == arr[x].second.second + solve(x + 1, taken + 1)) {       v2.push_back(arr[x].first);       trace(x + 1, taken + 1);       return;     }     int lef = min(s, x - taken);     if (lef < s) {       if (ret == arr[x].second.first + solve(x + 1, taken)) {         v1.push_back(arr[x].first);         trace(x + 1, taken);         return;       }     }     trace(x + 1, taken);   }   int main() {     cin >> n >> p >> s;     swap(p, s);     for (int i = 0; i < n; i++) {       cin >> arr[i].second.first;       arr[i].first = i + 1;     }     for (int i = 0; i < n; i++) {       cin >> arr[i].second.second;     }     sort(arr, arr + n, cmp);     memset(dp, -1, sizeof dp);     cout << solve(0, 0) <<   n ;     trace(0, 0);     for (auto i : v1) cout << i <<    ;     cout <<   n ;     for (auto i : v2) cout << i <<    ;     return 0;   }   