# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
634506 | TS_2392 | Knapsack (NOI18_knapsack) | C++14 | 378 ms | 19544 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>
#define FAST ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define all(x) (x).begin(),(x).end()
#define sqr(x) (x)*(x)
#define mp make_pair
#define fi first
#define se second
using namespace std;
typedef long long ll;
typedef long double ldb;
typedef pair<ll,ll> pll;
typedef pair<ll,int> pli;
typedef pair<int,ll> pil;
typedef pair<int,int> pii;
typedef pair<double,double> pdd;
typedef unsigned long long ull;
int s,n,dp[2001][2001],res;
vector<pii> w[2001];
int main(){
FAST;
cin>>s>>n;
for(int i=1;i<=n;++i){
int V,W,K;
cin>>V>>W>>K;
w[W].push_back(mp(V,K));
}
for(int i=1;i<=s;++i){
//cout<<i<<'\n';
sort(w[i].begin(),w[i].end(),greater<pii>());
for(int j=1;j<=s;++j){
Compilation message (stderr)
# | 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... |