# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
987000 | wood | Detecting Molecules (IOI16_molecules) | C++17 | 1 ms | 348 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>
using namespace std;
typedef long long ll;
typedef pair<int,int> p32;
typedef pair<ll,ll> p64;
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define vi vector<int>
#define vp32 vector<p32>
#define fast_cin() ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define MOD %1000000007
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
template <class T>
using Tree =
tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
//never guess
//never debug without reviewing code
//never try adding ones or substracting them
//only step by step debug when necessay
std::vector<int> find_subset(int l, int u, std::vector<int> W) {
vector<p64> w;
ll totalsum = 0;
for(int i = 0; i<W.size(); i++){ w.eb(W[i],i); totalsum+=W[i];}
sort(w.begin(),w.end());
ll sum = 0;
if(w[0].fi>u||totalsum<l) return{};
vi res;
int i;
for(i = 0; i<w.size()&&sum+w[i].fi<u; i++){
sum+=w[i].fi;
res.pb(w[i].se);
}
sum-=w[i-1].fi;
res.pop_back();
while(i<W.size()){
if(sum+w[i].fi<=u&&sum+w[i].fi>=l) res.pb(w[i].se);
i++;
}
return res;
}
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... |