제출 #794788

#제출 시각아이디문제언어결과실행 시간메모리
794788baneDetecting Molecules (IOI16_molecules)C++17
100 / 100
37 ms5548 KiB
#include<bits/stdc++.h> #include "molecules.h" using namespace std; mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); vector<int> find_subset(int L, int u, vector<int> k) { int n = (int)k.size(); vector<pair<int,int>>w(n); for (int i = 0; i < n; i++){ w[i] = {k[i], i}; } sort(w.begin(),w.end()); for (int i = 0; i < 1; i++){ //shuffle(w.begin(),w.end(),rng); int l = 0, r = 0; long long s = 0; while(r < n){ s += w[r].first; while(s > u){ s -= w[l].first; ++l; } if (s >= L && s <= u){ vector<int>ans; while(l<=r){ ans.push_back(w[l].second); ++l; } return ans; } ++r; } } return std::vector<int>(0); }
#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...