# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1273878 | almaz | Detecting Molecules (IOI16_molecules) | C++20 | 1 ms | 348 KiB |
#include "molecules.h"
#include <bits/stdc++.h>
using namespace std;
// #define int long long
// #define endl '\n'
#define ff first
#define ss second
#define pb push_back
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define ar array
const int MOD = 1e9 + 7,INF = 1e9, N = 2e5 + 5;
vector<int> find_subset(int x, int y, vector<int> w) {
sort(all(w));
int n = w.size();
vector <int> ans;
int sum = w[0];
int l = 0, r = 0;
while(l < n && r < n){
if(x <= sum && sum <= y){
for(int i = l;i <= r;i++){
ans.pb(i);
}
return ans;
}
else if(sum < x){
r++;
sum += w[r];
}
else if(sum > y && l < r){
sum -= w[l];
l++;
}
else{
return ans;
}
}
return ans;
}
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... |