This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#pragma GCC diagnostic warning "-std=c++11"
#include <bits/stdc++.h>
#include "molecules.h"
#define pb push_back
#define f first
#define s second
#define MOD 1000000007
#define flush fflush(stdout)
#define all(x) (x).begin(),(x).end()
#define allr(x) (x).rbegin(), (x).rend()
#define pii pair<int,int>
using namespace std;
int n,T,k;
int last[1005];
pii dp[1005];
vector<int> freq[10005];
vector<int> find_subset(int l, int u, vector<int> W) {
n=W.size();
vector<int> w; w.pb(0);
for (auto x:W) w.pb(x);
for (int i=1; i<=n; i++) {
for (int j=1000; j>=w[i]+1; j--) {
if (last[j-w[i]]) {
dp[j]={1,last[j-w[i]]};
last[j]=w[i];
}
}
dp[w[i]]={1,w[i]};
last[w[i]]=w[i];
}
for (int i=1; i<=n; i++) freq[w[i]].clear();
for (int i=1; i<=n; i++) freq[w[i]].pb(i-1);
vector<int> v;
for (int sum=l; sum<=u; sum++) {
if (dp[sum].f) {
vector<int> ind(10005,0);
int val=sum;
while (val) {
v.pb(freq[dp[val].s][ind[dp[val].s]]);
ind[dp[val].s]++;
val-=dp[val].s;
}
return v;
}
}
return v;
}
Compilation message (stderr)
molecules.cpp:1:32: warning: '-std=c++11' is not an option that controls warnings [-Wpragmas]
1 | #pragma GCC diagnostic warning "-std=c++11"
| ^~~~~~~~~~~~
# | 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... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |