제출 #378008

#제출 시각아이디문제언어결과실행 시간메모리
378008hackermubDetecting Molecules (IOI16_molecules)C++17
69 / 100
44 ms2668 KiB
#include "molecules.h" #include<bits/stdc++.h> using namespace std; //#define int long long #define pii pair<int,int> #define float long double #define fi first #define se second #define pb push_back #define all(v) v.begin(),v.end() #define sz(v) (int)v.size() std::vector<int> find_subset(int l, int u, std::vector<int> w) { int n=sz(w); vector<int> idx(n); iota(all(idx),0); sort(all(idx),[&w](int a,int b)->bool{ return w[a]<w[b]; }); int L=0,R=0,sum=w[idx[0]]; while(L<n && R<n && L<=R){ if(l<=sum && sum<=u) return vector<int>(idx.begin()+L,idx.begin()+R+1); if(sum<l && R+1<n) sum+=w[idx[R+1]],R++; else sum-=w[idx[L]],L++; } return {}; }
#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...