| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1304253 | Johan | Detecting Molecules (IOI16_molecules) | C++20 | 1 ms | 340 KiB |
#include "molecules.h"
#include "bits/stdc++.h"
using namespace std;
vector < int > find_subset(int l, int u, vector < int > w){
int n = w.size();
map < int , vector < int > > id;
for(int i = 0; i < w.size(); i++)
id[w[i]].push_back(i);
sort(w.begin(), w.end());
for(int i = 0; i < n; i++){
int j = i;
while(j < n && w[j] - w[i] <= u - l)j++;
int ans = 0;
vector < int > y;
for(int z = j; z >= i; z--){
ans += w[z];
y.push_back(w[z]);
if(ans > u){
ans -= w[z];
y.pop_back();
}
}
if(ans >= l && ans <= u){
vector < int > rs;
for(auto i : y){
rs.push_back(id[i].back());
id[i].pop_back();
}
reverse(rs.begin(), rs.end());
return rs;
}
}
return {};
}
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... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
