제출 #488672

#제출 시각아이디문제언어결과실행 시간메모리
488672ala2Detecting Molecules (IOI16_molecules)C++14
0 / 100
1 ms332 KiB
#include "molecules.h" #include<bits/stdc++.h> using namespace std; vector<int> find_subset(int l, int u, vector<int> w) { pair<int,int>p[10010]; int n=w.size(); for(int i=0;i<n;i++) { p[i].first=w[i]; p[i].second=i; } sort(p,p+n); int ll=0,rr=0; int sum=p[0].first; int bb=0; while(ll<=rr&&ll<n&&rr<n) { // cout<<ll<<" "<<rr<<endl; if(sum>u&&ll==rr) bb=1; if(sum>u) { ll++; sum-=p[ll-1].first; } if(sum>=l&&sum<=u) { break; } if(sum<l) { rr++; sum+=p[rr].first; } } vector<int>g; if(bb) { ll=1; rr=0; } for(int i=ll;i<=rr;i++) g.push_back(p[i].second); return g; } //15 25 //4 10 10 10 11
#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...