Submission #787424

#TimeUsernameProblemLanguageResultExecution timeMemory
787424TimDeeDetecting Molecules (IOI16_molecules)C++17
100 / 100
48 ms6584 KiB
#include "molecules.h" #include <bits/stdc++.h> using namespace std; #define forn(i,n) for(int i=0;i<n;++i) #define pb push_back #define all(x) x.begin(),x.end() #define pi pair<int,int> #define f first #define s second vector<int> find_subset(int l, int r, vector<int> w) { #define int long long int n=w.size(); int sum=0; vector<pi> a; forn(i,n) a.pb({w[i],i}); sort(all(a)); deque<int> st; int R=0; forn(L,n) { while (R<n && sum<l) { sum+=a[R].f; st.pb(a[R].s); ++R; } if (sum<l) break; if (sum>r) { sum-=a[L].f; st.pop_front(); continue; } vector<int32_t> z; for(auto&x:st) z.pb(x); return z; } return {}; #undef int }
#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...