제출 #600318

#제출 시각아이디문제언어결과실행 시간메모리
600318ShithilaDetecting Molecules (IOI16_molecules)C++14
69 / 100
54 ms4024 KiB
#include "molecules.h" #include <bits/stdc++.h> using namespace std; std::vector<int> find_subset(int l, int u, std::vector<int> w) { vector< pair<int,int> > wvect; int siz=w.size(); for (int i=0; i<siz; i++) { wvect.push_back( make_pair(w[i],i) ); } sort(wvect.begin(), wvect.end()); int x=0; int y=0; int sum=wvect[0].first; bool found=false; while(x<siz && y<siz) { //cout<<wvect[y].first<<" "<<wvect[x].first<<endl; //cout<<sum<<endl; if(sum>=l && sum<=u) { found=true; break; } else if(sum<l) { y++; sum=sum+wvect[y].first; } else { sum=sum-wvect[x].first; x++; } } vector<int> ans; if(found==true) { for(int i=x;i<y+1;i++) { ans.push_back( wvect[i].second); } } //cout<<x<<" "<<y<<endl; return ans; }
#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...