# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
172470 | gs18103 | Detecting Molecules (IOI16_molecules) | C++14 | 3 ms | 380 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "molecules.h"
#include <bits/stdc++.h>
#define fi first
#define se second
#define eb emplace_back
#define em emplace
#define all(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
const int MAX = 505050;
const int INF = INT_MAX >> 1;
const ll LINF = LLONG_MAX >> 1;
const ll mod = 1e9+9;
vector<int> find_subset(int l, int u, vector<int> w) {
vector <int> ans;
vector <pii> W;
for(int i = 0; i < w.size(); i++) W.eb(w[i], i);
sort(all(W));
reverse(all(W));
int sum = 0;
for(int i = 0; i < W.size(); i++) {
if(sum < l && sum + W[i].fi <= u) sum += W[i].fi, ans.eb(W[i].se);
if(sum >= l && sum <= u) break;
}
sort(all(ans));
if(sum >= l && sum <= u) return ans;
else return vector <int> {};
}
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... |