제출 #425405

#제출 시각아이디문제언어결과실행 시간메모리
425405ngraceDetecting Molecules (IOI16_molecules)C++14
69 / 100
61 ms5644 KiB
#include "molecules.h" #include <vector> #include <algorithm> #include <utility> using namespace std; #define v vector #define pii pair<int,int> std::vector<int> find_subset(int l, int u, std::vector<int> w) { int N=w.size(); v<pii> mol; for(int i=0;i<N;i++) mol.push_back({w[i],i}); sort(mol.begin(),mol.end()); v<int> out; int tot=mol[0].first; int lb=0; int ub=1; while(lb!=N){ if(tot<l){ if(ub!=N) { ub++; tot+=mol[ub-1].first; } else break; } else if(tot>u){ lb++; tot-=mol[lb-1].first; } else{ for(int i=lb;i<ub;i++){ out.push_back(mol[i].second); } break; } } return out; }
#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...