Submission #1009270

#TimeUsernameProblemLanguageResultExecution timeMemory
1009270bornagSchools (IZhO13_school)C++14
15 / 100
2091 ms19028 KiB
#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 timeMemoryGrader output
Fetching results...