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[10005];
bool dp[10005];
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=10000; j>=w[i]+1; j--) {
if (last[j-w[i]] && dp[j]==0) {
dp[j]=1;
last[j]=w[i];
}
}
if (dp[w[i]]==0) {
dp[w[i]]=1;
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]) {
vector<int> ind(10005,0);
int val=sum;
while (val) {
v.pb(freq[last[val]][ind[last[val]]]);
ind[last[val]]++;
val-=last[val];
}
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... |