Submission #290804

#TimeUsernameProblemLanguageResultExecution timeMemory
290804REALITYNBDetecting Molecules (IOI16_molecules)C++14
100 / 100
63 ms7160 KiB
#include <bits/stdc++.h> #define ll long long #define all(a) a.begin(),a.end() #define mp make_pair #define F first #define S second #define pii pair<long long ,int> using namespace std; vector<int> find_subset(int l , int r , vector<int> a){ int n = a.size() ; vector<pii> w(n) ; ll sum = 0 ; for(int i=0;i<n;i++){ w[i].F=a[i] ; sum+=a[i] ; w[i].S =i ; } sort(all(w)) ; vector<int> poop ; //for(int i=1;i<n;i++) w[i].F+=w[i-1].F ; sum=0 ; int L = 0 , R= 0 ; while(R<n){ sum+=w[R].F ; while(sum>r){ sum-= w[L].F ; L++; } if(l<=sum&&sum<=r) break ; R++ ; } // vector<int> poop ; if(R==n) return poop ; for(int i=L;i<=R;i++)poop.push_back(w[i].S) ; return poop ; }
#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...