Submission #297774

#TimeUsernameProblemLanguageResultExecution timeMemory
297774emnikDetecting Molecules (IOI16_molecules)C++14
0 / 100
1 ms384 KiB
#include <bits/stdc++.h> #include "molecules.h" using namespace std; typedef long long ll; #define pb push_back #define all(x) begin(x), end(x) #define IOS ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0); std::vector<int> find_subset(int l, int r, vector<int> W){ vector<int> b; vector<pair<int, int>> Pair; for(int i=0; i < (int)W.size(); i++){ Pair.pb({W[i], i}); } sort(Pair.begin(), Pair.end()); ll sum=0, x=0; for(int i=0; i < (int)Pair.size(); i++){ sum += (ll)Pair[i].first; if(sum > r){ sum -= (ll)Pair[x].first; x++; } if(sum >= l && sum <= r){ for(int j=x; j < (int)Pair.size(); j++){ b.pb(Pair[j].second); } break; } } return b; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...