# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1009270 | bornag | Schools (IZhO13_school) | C++14 | 2091 ms | 19028 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
const int maxn = 3e5;
int n, m, s;
int mchild[maxn];
int schild[maxn];
int sol = 0;
void req(int studs, int mi, int si, int i){
if(i == n){
sol = max(studs, sol);
} else {
if(si > 0) req(studs+schild[i], mi, si-1, i+1);
if(mi > 0) req(studs+mchild[i], mi-1, si, i+1);
req(studs, mi, si, i+1);
}
}
int main(){
cin >> n >> m >> s;
for(int i = 0; i < n; i++){
cin >> mchild[i] >> schild[i];
}
req(0, m, s, 0);
cout << sol << '\n';
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |