Submission #757090

#TimeUsernameProblemLanguageResultExecution timeMemory
7570901binJelly Flavours (IOI20_jelly)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> //#include "jelly.h" using namespace std; #define all(v) v.begin(), v.end() typedef long long ll; const int NMAX = 1e6 + 5; int dp[2003][1004], dp2[2003][1004]; vector<pair<int, int>> v; int find_maximum_unique(int Amx, int Bmx, vector<int> a, vector<int> b) { int n = a.size(); for(int i = 0; i < n; i++) v.emplace_back(a[i], b[i]); sort(all(v)); for(int i = 1; i <= n; i++){ auto&[a, b] = v[i]; for(int j = Amx; j >= a; j--) dp[i][j] = min(dp[i - 1][j] + b, dp[i - 1][j - a]); for(int j = a - 1; j >= 0; j--) dp[i][j] = dp[i - 1][j] + b; } for(int i = n; ) for(int i = 0; i <= n; i++){ if(i){ auto&[x, _, ia] = A[i - 1]; sum += x; sumA = sum; chk[ia] = 1; } memset(dp, 0, sizeof(dp)); int sumB = 0, cnt = 0; for(int j = 0; j <= n; j++){ if(j){ auto&[y, _, ib] = B[j - 1]; if(chk[ib]){ sumA -= a[ib]; for(int i = Amx; i >= a[ib]; i--) dp[i] = min(dp[i] + y, dp[i - a[ib]]); for(int i = a[ib] - 1; i >= 0; i--) dp[i] += y; cnt++; } else sumB += y; } if(sumA <= Amx && sumB <= Bmx && dp[Amx - sumA] <= Bmx - sumB) ans = max(ans, i + j - cnt); } } return ans; } /* int main(void){ ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n, Amx, Bmx; cin >> n >> Amx >> Bmx; vector<int> a(n), b(n); for(auto&x : a) cin >> x; for(auto&x : b) cin >> x; cout << find_maximum_unique(Amx, Bmx, a, b); return 0; } */ /* 3 2 3 2 1 4 2 3 2 5 6 12 5 1 5 6 3 3 5 4 6 7 */

Compilation message (stderr)

jelly.cpp: In function 'int find_maximum_unique(int, int, std::vector<int>, std::vector<int>)':
jelly.cpp:18:14: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
   18 |         auto&[a, b] = v[i];
      |              ^
jelly.cpp:23:20: error: expected primary-expression before ')' token
   23 |     for(int i = n; )
      |                    ^
jelly.cpp:23:19: error: expected ';' before ')' token
   23 |     for(int i = n; )
      |                   ^~
      |                   ;
jelly.cpp:27:18: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
   27 |             auto&[x, _, ia] = A[i - 1];
      |                  ^
jelly.cpp:27:31: error: 'A' was not declared in this scope
   27 |             auto&[x, _, ia] = A[i - 1];
      |                               ^
jelly.cpp:28:13: error: 'sum' was not declared in this scope
   28 |             sum += x; sumA = sum;
      |             ^~~
jelly.cpp:28:23: error: 'sumA' was not declared in this scope
   28 |             sum += x; sumA = sum;
      |                       ^~~~
jelly.cpp:29:13: error: 'chk' was not declared in this scope
   29 |             chk[ia] = 1;
      |             ^~~
jelly.cpp:35:22: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
   35 |                 auto&[y, _, ib] = B[j - 1];
      |                      ^
jelly.cpp:35:35: error: 'B' was not declared in this scope
   35 |                 auto&[y, _, ib] = B[j - 1];
      |                                   ^
jelly.cpp:36:20: error: 'chk' was not declared in this scope
   36 |                 if(chk[ib]){
      |                    ^~~
jelly.cpp:37:21: error: 'sumA' was not declared in this scope; did you mean 'sumB'?
   37 |                     sumA -= a[ib];
      |                     ^~~~
      |                     sumB
jelly.cpp:45:16: error: 'sumA' was not declared in this scope; did you mean 'sumB'?
   45 |             if(sumA <= Amx && sumB <= Bmx && dp[Amx - sumA] <= Bmx - sumB) ans = max(ans, i + j - cnt);
      |                ^~~~
      |                sumB
jelly.cpp:45:76: error: 'ans' was not declared in this scope; did you mean 'abs'?
   45 |             if(sumA <= Amx && sumB <= Bmx && dp[Amx - sumA] <= Bmx - sumB) ans = max(ans, i + j - cnt);
      |                                                                            ^~~
      |                                                                            abs
jelly.cpp:23:13: warning: unused variable 'i' [-Wunused-variable]
   23 |     for(int i = n; )
      |             ^
jelly.cpp:48:9: error: 'ans' was not declared in this scope; did you mean 'abs'?
   48 |  return ans;
      |         ^~~
      |         abs