# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1009212 |
2024-06-27T10:05:16 Z |
ivopav |
Schools (IZhO13_school) |
C++17 |
|
2000 ms |
262144 KB |
#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast,unroll-loops")
#pragma GCC target("avx2,popcnt,lzcnt,abm,bmi,bmi2,fma,tune=native")
int main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
long long int n;
long long int m;
long long int k;
cin >> n >> m >> k;
vector<long long int> gla={};
vector<long long int> spr={};
for (long long int i=0;i<n;i++){
long long int unos;
long long int unos2;
cin >> unos >> unos2;
gla.push_back(unos);
spr.push_back(unos2);
}
vector<vector<long long int>> dp(m+1,vector<long long int>(k+1,0));
vector<vector<long long int>> dp2(m+1,vector<long long int>(k+1,0));
for (long long int i=0;i<n;i++){
for (long long int j=0;j<m+1;j++){
for (long long int l=0;l<k+1;l++){
// cout << i << " " << j << " " << l << " " << dp[i][j][l] << "\n";
dp2[j][l]=max(dp[j][l],dp2[j][l]);
if (j!=m){
dp2[j+1][l]=max(dp[j][l]+gla[i],dp2[j+1][l]);
}
if (l!=k){
dp2[j][l+1]=max(dp[j][l]+spr[i],dp2[j][l+1]);
}
}
}
dp=dp2;
}
cout << dp2[m][k] << "\n";
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
2 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
12 ms |
348 KB |
Output is correct |
7 |
Execution timed out |
2100 ms |
5724 KB |
Time limit exceeded |
8 |
Execution timed out |
2061 ms |
7772 KB |
Time limit exceeded |
9 |
Execution timed out |
2102 ms |
29784 KB |
Time limit exceeded |
10 |
Execution timed out |
2057 ms |
9560 KB |
Time limit exceeded |
11 |
Execution timed out |
2048 ms |
28492 KB |
Time limit exceeded |
12 |
Execution timed out |
2045 ms |
5720 KB |
Time limit exceeded |
13 |
Runtime error |
108 ms |
262144 KB |
Execution killed with signal 9 |
14 |
Runtime error |
115 ms |
262144 KB |
Execution killed with signal 9 |
15 |
Execution timed out |
2067 ms |
7616 KB |
Time limit exceeded |
16 |
Runtime error |
126 ms |
262144 KB |
Execution killed with signal 9 |
17 |
Runtime error |
142 ms |
262144 KB |
Execution killed with signal 9 |
18 |
Runtime error |
133 ms |
262144 KB |
Execution killed with signal 9 |
19 |
Runtime error |
137 ms |
262144 KB |
Execution killed with signal 9 |
20 |
Runtime error |
146 ms |
262144 KB |
Execution killed with signal 9 |