Submission #432529

#TimeUsernameProblemLanguageResultExecution timeMemory
432529MarcoMeijerDetecting Molecules (IOI16_molecules)C++14
9 / 100
1 ms204 KiB
#include "molecules.h" #include <bits/stdc++.h> using namespace std; // macros typedef long long ll; typedef long double ld; typedef pair<int, int> ii; typedef pair<ll, ll> lll; typedef tuple<int, int, int> iii; typedef vector<int> vi; typedef vector<ii> vii; typedef vector<iii> viii; typedef vector<ll> vll; typedef vector<lll> vlll; #define REP(a,b,c) for(int a=int(b); a<int(c); a++) #define RE(a,c) REP(a,0,c) #define RE1(a,c) REP(a,1,c+1) #define REI(a,b,c) REP(a,b,c+1) #define REV(a,b,c) for(int a=int(c-1); a>=int(b); a--) #define FOR(a,b) for(auto& a : b) #define all(a) a.begin(), a.end() #define INF 1e9 #define EPS 1e-9 #define pb push_back #define popb pop_back #define fi first #define se second #define sz size() mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count()); vi find_subset(int l, int u, vi w) { int n = w.size(); vi sa; RE(i,n) sa.pb(i); sort(all(sa),[&](int i, int j) { return w[i]<w[j]; }); int lb=0; ll total = 0; RE(ub,w.size()) { total += w[sa[ub]]; while(total > u) total -= w[sa[lb++]]; if(total >= l && total <= u) { vi ans; REP(i,lb,ub+1) ans.pb(i); return ans; } } 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...