Submission #501596

#TimeUsernameProblemLanguageResultExecution timeMemory
501596dnauxDetecting Molecules (IOI16_molecules)C++17
19 / 100
1 ms292 KiB
#include <bits/stdc++.h> #include "molecules.h" #define endline "\n" #define pb push_back #define mp make_pair #define st first #define nd second #define lsb(i) i&(-i) #define sz(i) (int)i.size() typedef long long ll; using namespace std; const ll INF = 1e18L; constexpr int mod = int(1e9) + 7; ll t=1, n, m, k, q, s, cases = 0, timee = 0; vector<int> find_subset(int l, int u, vector<int> ar){ n = sz(ar); vector<int> ans; ll sum = ar[0], i = 0, j = 0; for(;i < n or j < n;){ if(sum >= l and sum <= u){ for(int k = i; k <= j; k++)ans.pb(k); return ans; } else if(i >= n){ j++;sum += ar[j]; } else if(j >= n){ sum -= ar[i]; i++; } else if(sum < l){ j++; sum += ar[j]; } else if(sum > u){ sum -= ar[i]; i++; } } 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...