Submission #1188293

#TimeUsernameProblemLanguageResultExecution timeMemory
1188293alwaus424Knapsack (NOI18_knapsack)C++20
Compilation error
0 ms0 KiB
#include <bits/stdc++.h>
using namespace std;
#define fr(n) for (int i = 0; i < n; i++)
typedef long long ll;

void always424() {
    int s, n;
    cin >> s >> n;
    vector<tuple<int, int, int>> v(n);

    fr(n) {
        int a, b, c;
        cin >> a >> b >> c;
        v[i] = make_tuple(a, b, c);
    }

    ll tot = 1;
    ll ans = 0;
    int cost = get<0>(v[0]);
    int weight = get<1>(v[0]);
    int quantity = get<2>(v[0]);

    while (tot <= s && quantity > 0) {
        tot += weight;
        ans += cost;
        quantity--;
    }

    cout << ans << '\n';
}

Compilation message (stderr)

/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/11/../../../x86_64-linux-gnu/crt1.o: in function `_start':
(.text+0x1b): undefined reference to `main'
collect2: error: ld returned 1 exit status