Submission #673750

#TimeUsernameProblemLanguageResultExecution timeMemory
673750mmkJelly Flavours (IOI20_jelly)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #include "jelly.h" #define fr first #define sc second using namespace std; const int INF = 0x3f3f3f3f; const int MAXN = 2e3+10; const int MAXX = 1e4+10; struct jelly { int a,b; }; jelly val[MAXN]; bool cmp(jelly a, jelly b) { return a.a < b.a; } pair<int,int> dp[MAXN][MAXX]; int find_maximum_unique(int x, int y, vector<int> a, vector<int> b) { int n = a.size(); for(int i = 1; i <= n; i++) { val[i].a = a[i]; val[i].b = b[i]; } sort(val+1,val+(n+1),cmp); dp[0][0] = {0,x}; for(int i = 1; i <= y; i++) dp[0][i] = {-1,-1}; int resp = 0; for(int i = 1; i <= n; i++) { for(int j = 0; j <= y; j++) { dp[i][j] = dp[i-1][j]; if(dp[i][j].sc >= val[i].a) { dp[i][j].fr++; dp[i][j].sc -= val[i].a; } if(j >= val[i].b) { pair<int,int> aux = dp[i][j-val[i].b]; if(aux.fr > dp[i][j].fr || (aux.fr == dp[i][j].fr && aux.sc > dp[i][j].sc) dp[i][j] = aux; } resp = max(resp,dp[i][j].fr); } } return resp; }

Compilation message (stderr)

jelly.cpp: In function 'int find_maximum_unique(int, int, std::vector<int>, std::vector<int>)':
jelly.cpp:46:79: error: expected ';' before 'dp'
   46 |     if(aux.fr > dp[i][j].fr || (aux.fr == dp[i][j].fr && aux.sc > dp[i][j].sc)
      |                                                                               ^
      |                                                                               ;
   47 |      dp[i][j] = aux;
      |      ~~                                                                        
jelly.cpp:46:29: warning: statement has no effect [-Wunused-value]
   46 |     if(aux.fr > dp[i][j].fr || (aux.fr == dp[i][j].fr && aux.sc > dp[i][j].sc)
      |        ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
jelly.cpp:48:4: error: expected primary-expression before '}' token
   48 |    }
      |    ^
jelly.cpp:47:21: error: expected ')' before '}' token
   47 |      dp[i][j] = aux;
      |                     ^
      |                     )
   48 |    }
      |    ~                 
jelly.cpp:46:7: note: to match this '('
   46 |     if(aux.fr > dp[i][j].fr || (aux.fr == dp[i][j].fr && aux.sc > dp[i][j].sc)
      |       ^
jelly.cpp:48:4: error: expected primary-expression before '}' token
   48 |    }
      |    ^