This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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) {
int maxi = 0;
for (int i = 1; i <= k[0]; i++) {
int total_weight = w[0] * i;
int total_value = v[0] * i;
if (total_weight <= s) {
maxi = max(maxi, total_value);
} else {
break;
}
}
cout << maxi << endl;
}
}
int32_t main() {
setIO();
solve();
return 0;
}
# | 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... |