Submission #471045

#TimeUsernameProblemLanguageResultExecution timeMemory
471045EvangKnapsack (NOI18_knapsack)C++17
Compilation error
0 ms0 KiB
#include "bits/extc++.h" #define int ll using namespace std; #ifdef LOCAL #define dout(x) clog << "Line " << __LINE__ << ": " << #x << "=" << (x) << el #else #define dout(x) #endif #define inf 1000000000 #define llinf 1000000000000000000ll #define uset unordered_set #define umap unordered_map #define mp(a,b) make_pair(a,b) #define mt(x...) make_tuple(x) #define eb(x...) emplace_back(x) #define pb(x) push_back(x) #define ff first #define ss second const char el = '\n', sp = ' '; typedef long long ll; typedef vector<int> vi; typedef pair<int, int> ii; typedef vector<ii> vii; template<class T> using minpq = priority_queue<T, vector<T>, greater<T>>; const int S = 2005; int s, n, dp[S]; void fun(int a, int c){ for(int i = s; i >= c; --i) dp[i] = max(dp[i], dp[i-c] + a); } int32_t main() { cin.tie(nullptr)->sync_with_stdio(false); #ifdef LOCAL freopen("output.txt", "w", stdout); freopen("debug.txt", "w", stderr); #endif cin >> s >> n; while(n--){ int a, c, k; cin >> a >> c >> k; while(k--) { fun(a, c); } // bool cur = 0; // while(k>0 && c <= s){ // if(k&1) { // fun(a, c); // cur = 0; // } else if(cur) // fun(a, c); // else{ // fun(a, c); // fun(a, c); // cur = 1; // } // k/=2; // a *= 2; // c *= 2; } } cout << dp[s]; }

Compilation message (stderr)

knapsack.cpp:68:5: error: 'cout' does not name a type; did you mean 'dout'?
   68 |     cout << dp[s];
      |     ^~~~
      |     dout
knapsack.cpp:69:1: error: expected declaration before '}' token
   69 | }
      | ^