| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1367648 | mariza | Detecting Molecules (IOI16_molecules) | C++20 | 0 ms | 344 KiB |
#include "molecules.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
vector<int> find_subset(int l, int r, vector<int> a) {
ll n=a.size();
sort(a.begin(),a.end());
// ll cl=l, cr=r;
// bool ok=0;
// for(ll i=0; i<n; i++){
// cl-=a[n-1-i];
// cr-=a[i];
// if(cl<=0 && 0<=cr) ok=1;
// }
// if(!ok) return vector<int>();
bool ans[n+1][l]={};
for(ll i=n-1; i>=0; i--){
for(ll x=0; x<l; x++){
if(x+a[i]>r) ans[i][x]=ans[i+1][x];
else if(x+a[i]>=l) ans[i][x]=1;
else ans[i][x]=ans[i+1][x]|ans[i+1][x+a[i]];
}
}
vector<int> s;
ll x=0;
for(ll i=0; i<n; i++){
if(x+a[i]<=r && (x+a[i]>=l || ans[i+1][x+a[i]]==1)){
s.push_back(i);
x+=a[i];
}
if(x>=l) break;
}
return s;
}
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
