| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 1339247 | lha9002 | Knapsack (NOI18_knapsack) | C++20 | 1096 ms | 460 KiB |
#include <bits/stdc++.h>
#define FOR(i, l, r) for (int i = l; i <= r; ++i)
#define FORD(i, r, l) for (int i = r; i >= l; --i)
#define pb push_back
#define ll long long
#define all(x) (x).begin(), (x).end()
#define fi first
#define se second
#define ii pair<int,int>
#define li pair<ll , int>
using namespace std;
const int N = 1e6;
const int N1 = 2e5;
const int Mod = 1e9 + 7;
int n;
ll f[N + 3];
ll s;
signed main(){
ios_base::sync_with_stdio(0);
cin.tie(0); cout.tie(0);
#define NAME "test"
// freopen(NAME".in", "r" , stdin);
// freopen(NAME".out" , "w" , stdout);
if(fopen(NAME".inp" , "r")){
freopen(NAME".inp", "r" , stdin);
freopen(NAME".out" , "w" , stdout);
}
cin >> s >> n;
FOR(i , 1 , n){
ll val,wei,sl;
cin >> val >> wei >> sl;
FORD(j , s , 1)
FOR(k , 1 , sl){
if(wei * k > j) break;
f[j] = max(f[j] , f[j - wei * k] + val * k);
}
}
cout << f[s];
return 0;
}
//}
// LHA - Fail - gpt - try again
// 👨❤️👨👨❤️👨👨❤️👨👨❤️👨👨❤️👨👨❤️👨👨❤️👨👨❤️👨👨❤️👨👨❤️👨👨❤️👨👨❤️👨
//
// ╔███╗ ██╗ ██╗ █████╗
// ║███║ ██║ ██║ ██╔══██╗
// ║███║ ███████║ ███████║
// ║███║ ██╔══██║ ██╔══██║
// ║█████║ ██║ ██║ ██║ ██║
// ╚═════╝ ╚═╝ ╚═╝ ╚═╝ ╚═╝
//
// A N H
// 👨❤️👨👨❤️👨👨❤️👨👨❤️👨👨❤️👨👨❤️👨👨❤️👨👨❤️👨👨❤️👨👨❤️👨👨❤️👨👨❤️👨
// <<<===✦ DP core magic ✦===>>>
컴파일 시 표준 에러 (stderr) 메시지
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
