# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
444665 | Khizri | Detecting Molecules (IOI16_molecules) | C++17 | 66 ms | 8876 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;
#define ll long long
#define pb push_back
#define F first
#define S second
#define INF 1e18
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define pii pair<int,int>
#define pll pair<ll,ll>
#define OK cout<<"Ok"<<endl;
#define MOD (ll)(1e9+7)
#define endl "\n"
const int mxn=2e5+5;
vector<pii>dp[mxn];
map<int,bool>mp;
std::vector<int> find_subset(int l, int r, std::vector<int> vt) {
vector<pii>arr;
for(int i=0;i<vt.size();i++){
arr.pb({vt[i],i});
}
sort(all(arr));
ll sum=0;
int a=0,b=0;
bool q=false;
for(int i=0;i<arr.size();i++){
sum+=arr[i].F;
if(sum<l){
}
else{
if(l<=sum&&sum<=r){
q=true;
b=i;
break;
}
else{
while(sum>r){
sum-=arr[a].F;
a++;
}
}
if(l<=sum&&sum<=r){
q=true;
b=i;
break;
}
}
}
vector<int>v;
if(q){
for(int i=a;i<=b;i++){
v.pb(arr[i].S);
}
sort(all(v));
return v;
}
return v;
}
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... |