# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1178441 | batman3747 | Detecting Molecules (IOI16_molecules) | C++20 | 33 ms | 3656 KiB |
#include "bits/stdc++.h"
#define all(x) (x).begin(), (x).end()
#define debug(x) cerr << (#x) << " " << (x) << endl
#define SZ(s) ((int)s.size())
#define pb push_back
#define ff first
#define ss second
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;
vi find_subset(int s, int e, vi w){
int n = SZ(w);
vector<pii> a(n);
for(int i = 0; i < n; i ++) a[i] = {w[i], i};
sort(all(a));
ll sum = 0;
vi ans;
for(int i = 0, j = 0; i < n; i ++){
sum += a[i].ff;
while(sum > e) sum -= a[j ++].ff;
if(sum >= s){
for(int k = j; k <= i; k ++) ans.pb(a[k].ss);
break;
}
}
return ans;
}
//int main(){
// ios::sync_with_stdio(0);
// cin.tie(0);
// cout.tie(0);
// return 0;
//}
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... |