Submission #1169464

#TimeUsernameProblemLanguageResultExecution timeMemory
1169464bbartekJelly Flavours (IOI20_jelly)C++20
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #include "jelly.h" using namespace std; typedef long long ll; #define st first #define nd second #define pb push_back const int maxn = 2003; int dp[2003][10003]; int find_maximum_unique(int x, int y, vector<int> a, vector<int> b) { pair<int,int> sortowane; for(int i=0;i<n;i++){ sortowane.pb({a[i],b[i]}); } sort(sortowane.begin(),sortowane.end()); dp[0][0] = y; int wyn=0,akt,ile; vector<int> reszta; for(int i=1;i<=n;i++){ for(int j=0;j<=x;j++){ if(j>0) dp[i][j] = dp[i][j-1]; if(j >= sortowane[i-1].st) dp[i][j] = max(dp[i][j],dp[i-1][j-sortowane[i-1].st]); if(dp[i-1][j] >= sortowane[i-1].nd) dp[i][j] = max(dp[i][j],dp[i-1][j] - sortowane[i-1].nd); } akt = i; ile = dp[i][x]; reszta.clear(); for(int j=i+1;j<=n;j++){ reszta.pb(sortowane[i-1].nd); } sort(reszta.begin(),reszta.end()); for(auto j : reszta){ if(j > ile) break; ile -= j; akt++; } wyn = max(wyn,akt); } return wyn; } /* int main(){ int odp = find_maximum_unique(15,12,{0,0,1,1,1,2,4,9,5},{0,0,1,1,1,2,4,9,5}); cout<<odp<<"\n"; return 0; } */

Compilation message (stderr)

jelly.cpp: In function 'int find_maximum_unique(int, int, std::vector<int>, std::vector<int>)':
jelly.cpp:17:19: error: 'n' was not declared in this scope
   17 |     for(int i=0;i<n;i++){
      |                   ^
jelly.cpp:9:12: error: 'struct std::pair<int, int>' has no member named 'push_back'
    9 | #define pb push_back
      |            ^~~~~~~~~
jelly.cpp:18:19: note: in expansion of macro 'pb'
   18 |         sortowane.pb({a[i],b[i]});
      |                   ^~
jelly.cpp:20:20: error: 'struct std::pair<int, int>' has no member named 'begin'
   20 |     sort(sortowane.begin(),sortowane.end());
      |                    ^~~~~
jelly.cpp:20:38: error: 'struct std::pair<int, int>' has no member named 'end'
   20 |     sort(sortowane.begin(),sortowane.end());
      |                                      ^~~
jelly.cpp:25:20: error: 'n' was not declared in this scope
   25 |     for(int i=1;i<=n;i++){
      |                    ^
jelly.cpp:29:30: error: no match for 'operator[]' (operand types are 'std::pair<int, int>' and 'int')
   29 |             if(j >= sortowane[i-1].st)
      |                              ^
jelly.cpp:30:60: error: no match for 'operator[]' (operand types are 'std::pair<int, int>' and 'int')
   30 |                 dp[i][j] = max(dp[i][j],dp[i-1][j-sortowane[i-1].st]);
      |                                                            ^
jelly.cpp:31:39: error: no match for 'operator[]' (operand types are 'std::pair<int, int>' and 'int')
   31 |             if(dp[i-1][j] >= sortowane[i-1].nd)
      |                                       ^
jelly.cpp:32:63: error: no match for 'operator[]' (operand types are 'std::pair<int, int>' and 'int')
   32 |                 dp[i][j] = max(dp[i][j],dp[i-1][j] - sortowane[i-1].nd);
      |                                                               ^
jelly.cpp:38:32: error: no match for 'operator[]' (operand types are 'std::pair<int, int>' and 'int')
   38 |             reszta.pb(sortowane[i-1].nd);
      |                                ^