Submission #427525

#TimeUsernameProblemLanguageResultExecution timeMemory
427525lakshith_Jelly Flavours (IOI20_jelly)C++14
19 / 100
276 ms152644 KiB
#include <bits/stdc++.h> #include "jelly.h" using namespace std; int find_maximum_unique(int x, int y, vector<int> a, vector<int> b){ int n = a.size(); vector<int> ind(n); for(int i = 0; i < n; i++) ind[i] = i; pair<int, int> dp[n + 1][x + 1]; for(int i = 0; i <= n; i++) for(int j = 0; j <= x; j++) dp[i][j] = {0, 0}; dp[0][x] = {0, y}; for(int i = 0; i < n; i++) for(int j = 0; j <= x; j++){ if (j >= a[ind[i]]) dp[i + 1][j - a[ind[i]]] = max(dp[i + 1][j - a[ind[i]]], {dp[i][j].first + 1, dp[i][j].second}); if (dp[i][j].second >= b[ind[i]]) dp[i + 1][j] = max(dp[i + 1][j], {dp[i][j].first + 1, dp[i][j].second - b[ind[i]]}); dp[i + 1][j] = max(dp[i + 1][j], dp[i][j]); } int res = 0; for(int j = 0; j <= x; j++) res = max(res, dp[n][j].first); return res; }

Compilation message (stderr)

jelly.cpp: In function 'int find_maximum_unique(int, int, std::vector<int>, std::vector<int>)':
jelly.cpp:24:5: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
   24 |     for(int j = 0; j <= x; j++)
      |     ^~~
jelly.cpp:26:2: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
   26 |  return res;
      |  ^~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...