// vegnim
#include <bits/stdc++.h>
using namespace std;
typedef unsigned int ui;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair <int,int> pii;
typedef pair <ll,ll> pll;
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define setpre(n) fixed << setprecision(n)
#define sz(x) (int)x.size()
#define all(x) x.begin(), x.end()
#define mask(n) (1LL << (n))
#define getbit(x, b) (((x) >> (b)) & 1)
#define FOR(i, a, b) for (int i = (a); i <= (b); i++)
#define FORd(i, a, b) for (int i = (a); i >= (b); i--)
#define REP(i, n) for (int i = 0; i < (n); i++)
#define task ""
#define dbg if (DEBUG_MODE)
const bool DEBUG_MODE = 1;
const int maxN = 1e5+5;
int s,n,v[maxN],w[maxN],k[maxN];
namespace sub1
{
void solve()
{
ll ans = 0;
while (k[1]-- && s - w[1] >= 0){
ans += v[1];
s -= w[1];
}
cout << ans;
}
}
signed main()
{
ios_base::sync_with_stdio(NULL); cin.tie(nullptr);
// freopen("inp.txt","r",stdin);
cin >> s >> n;
FOR(i, 1, n){
cin >> v[i] >> w[i] >> k[i];
}
if (n == 1){
sub1::solve();
return 0;
}
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... |