# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1009204 |
2024-06-27T10:01:47 Z |
ivopav |
Schools (IZhO13_school) |
C++17 |
|
188 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<vector<long long int>>> dp(n+1,vector<vector<long long int>>(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";
dp[i+1][j][l]=max(dp[i][j][l],dp[i+1][j][l]);
if (j!=m){
dp[i+1][j+1][l]=max(dp[i][j][l]+gla[i],dp[i+1][j+1][l]);
}
if (l!=k){
dp[i+1][j][l+1]=max(dp[i][j][l]+spr[i],dp[i+1][j][l+1]);
}
}
}
}
cout << dp[n][m][k] << "\n";
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 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 |
1372 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
15 ms |
7004 KB |
Output is correct |
7 |
Runtime error |
101 ms |
262144 KB |
Execution killed with signal 9 |
8 |
Runtime error |
106 ms |
262144 KB |
Execution killed with signal 9 |
9 |
Runtime error |
113 ms |
262144 KB |
Execution killed with signal 9 |
10 |
Runtime error |
102 ms |
262144 KB |
Execution killed with signal 9 |
11 |
Runtime error |
103 ms |
262144 KB |
Execution killed with signal 9 |
12 |
Runtime error |
108 ms |
262144 KB |
Execution killed with signal 9 |
13 |
Runtime error |
121 ms |
262144 KB |
Execution killed with signal 9 |
14 |
Runtime error |
135 ms |
262144 KB |
Execution killed with signal 9 |
15 |
Runtime error |
155 ms |
262144 KB |
Execution killed with signal 9 |
16 |
Runtime error |
167 ms |
262144 KB |
Execution killed with signal 9 |
17 |
Runtime error |
188 ms |
262144 KB |
Execution killed with signal 9 |
18 |
Runtime error |
174 ms |
262144 KB |
Execution killed with signal 9 |
19 |
Runtime error |
177 ms |
262144 KB |
Execution killed with signal 9 |
20 |
Runtime error |
185 ms |
262144 KB |
Execution killed with signal 9 |