# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
967849 | hippo123 | Knapsack (NOI18_knapsack) | C++17 | 1080 ms | 2816 KiB |
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;
typedef long long ll;
struct d1{
int v, w, k;
double r;
};
bool comp(d1 a, d1 b){
if(a.r==b.r) return a.w<b.w;
return a.r>b.r;
}
int main(){
cin.tie(0)->sync_with_stdio(false);
int s, n; cin>>s>>n;
vector<d1> d(n);
for (int i=0; i<n; i++) {
cin>>d[i].v>>d[i].w>>d[i].k;
d[i].r=double(d[i].v)/d[i].w;
}
sort(d.begin(), d.end(), comp);
vector<int> dp(s+1, -1);
dp[0]=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... |