제출 #1108323

#제출 시각아이디문제언어결과실행 시간메모리
1108323expert007Knapsack (NOI18_knapsack)C++14
0 / 100
162 ms500 KiB
#include "bits/stdc++.h" using namespace std; #define ull unsigned long long #define int long long const int MOD = 1e9 + 7; void setIO() { cin.tie(0)->sync_with_stdio(0); } void solve() { int s, n; cin >> s >> n; vector<int> v(n), w(n), k(n); for (int i = 0; i < n; i++) { cin >> v[i] >> w[i] >> k[i]; } if (n == 1) { if (w[0] * k[0] <= s) { cout << v[0] * k[0] << endl; } else { int maxi = 0; for (int i = 1; i <= k[0]; i++) { if (w[0] * i < s) { maxi = max(maxi, v[0] * i); } } cout << maxi << endl; } } } int32_t main() { setIO(); solve(); return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...