이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#/****Bismillahir rahmanir rahim****/
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<long long> vl;
typedef vector<double> vd;
#define All(a) a.begin(), a.end()
template <typename T>
void get_vector(T &a)
{
for (auto &e : a)
cin >> e;
}
template <typename T>
void put_vector(T a)
{
for (auto e : a)
cout << e << " ";
cout << endl;
}
vector<int> find_subset(int l, int u, vi w)
{
int n =w.size();
vi res;
bool dp[n+1][u+1];
for(int i = 0; i<=n; i++)for(int j = 0; j<=u; j++)dp[i][j] = 0;
dp[0][0] = 1;
for(int i = 1; i<=n; i++){
for(int j = 0; j<=u; j++){
if(dp[i-1][j]){
dp[i][j] = 1;
if(j+w[i-1]<=u){
dp[i][j+w[i-1]] = 1;
}
}
if(dp[i][j]&&j>=l)
{
int x = j;
while(x>0){
res.push_back(i);
x -= w[i-1];
i--;
}
reverse(res.begin(),res.end());
return res;
}
}
}
return res;
}
# | 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... |