제출 #983305

#제출 시각아이디문제언어결과실행 시간메모리
983305fasgqwrgqwgKnapsack (NOI18_knapsack)C++17
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; #ifndef ONLINE_JUDGE #include "/debug.cpp" #else #define debug(...) 0 #endif #define yes cout << "YES" << '\n' #define no cout << "NO" << '\n' #define pll pair<long long, long long> #define pii pair<int, int> #define newl "\n" #define vt vector #define ar array #define LOOP(iter) iter.begin(), iter.end() #define FOR(i, n) for (ll i = 0; i < n; i++) #define FORK(i, n, k) for (ll i = k; i < n; i++) #define ll long long #define ld long double #define sza(x) ((int)x.size()) #define all(a) (a).begin(), (a).end() #define pb(x) push_back(x) #define ff first #define ss second #define CEIL(a, b) ((a + b - 1) / b) #define fileio(in, out) \ freopen(in, "r", stdin); \ freopen(out, "w", stdout) const int MAX_N = 1e5 + 5; const ll MOD_INV = 500000004; const ll MOD = 1e9 + 7; const ll INF = 10e9 + 5; const ld EPS = 1e-9; template<class T> bool ckmax(T& a, const T& b) { return a < b ? a = b, 1 : 0; } void solve() { ll n, s; cin >> s >> n; vector<ll> v(n), w(n), k(n); for (int i = 0; i < n; i++) { cin >> v[i]; cin >> w[i]; cin >> k[i]; } vector<vector<pll>> dp(n + 1, vector<pll>(s + 1, {0, 0})); for (ll i = 1; i <= n; i++) { for (ll j = 0; j <= s; j++) { dp[i][j] = dp[i - 1][j]; if (j - w[i] >= 0) { if (dp[i][j].ff < dp[i - 1][j - w[i]].ff + v[i]) { dp[i][j].ff = dp[i - 1][j - w[i]].ff + v[i]; dp[i][j].ss = 1; } if (dp[i][j].ff < dp[i][j - w[i]].ff and dp[i][j].ss + 1 <= k[i]) { dp[i][j].ff = dp[i][j - w[i]].ff + v[i]; dp[i][j].ss++; } } } } cout << dp[n][s].ff; } int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int tc = 1; // cin >> tc; for (int t = 1; t <= tc; t++) { // cout << "Case #" << t << ": "; solve(); } }

컴파일 시 표준 에러 (stderr) 메시지

knapsack.cpp:6:10: fatal error: /debug.cpp: No such file or directory
    6 | #include "/debug.cpp"
      |          ^~~~~~~~~~~~
compilation terminated.