Submission #1108322

#TimeUsernameProblemLanguageResultExecution timeMemory
1108322expert007Knapsack (NOI18_knapsack)C++17
0 / 100
167 ms584 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...