Submission #932936

#TimeUsernameProblemLanguageResultExecution timeMemory
932936stefanneaguSchools (IZhO13_school)C++17
30 / 100
160 ms262144 KiB
#include <bits/stdc++.h> using namespace std; const int nmax = 1e5 + 1; struct str{ int a, b; } v[nmax]; int main() { int n, m, k; cin >> n >> m >> k; for(int i = 1; i <= n; i ++) { cin >> v[i].a >> v[i].b; } long long dp[n + 1][m + 1][k + 1]; memset(dp, 0, sizeof(dp)); for(int i = 1; i <= n; i ++) { for(int j = 0; j <= m; j ++) { for(int p = 0; p <= k; p ++) { int x = 0; dp[i][j][p] = dp[i - 1][j][p]; if(j != 0) { dp[i][j][p] = max(dp[i][j][p], dp[i - 1][j - 1][p] + v[i].a); } if(p != 0) { dp[i][j][p] = max(dp[i][j][p], dp[i - 1][j][p - 1] + v[i].b); } } } } cout << dp[n][m][k]; return 0; }

Compilation message (stderr)

school.cpp: In function 'int main()':
school.cpp:21:13: warning: unused variable 'x' [-Wunused-variable]
   21 |         int x = 0;
      |             ^
#Verdict Execution timeMemoryGrader output
Fetching results...