Submission #350938

#TimeUsernameProblemLanguageResultExecution timeMemory
350938spike1236Detecting Molecules (IOI16_molecules)C++14
9 / 100
1 ms512 KiB
#include <bits/stdc++.h> using namespace std; #define pb push_back #define mp make_pair #define f first #define s second #define ll long long #define ld long double #define all(_v) _v.begin(), _v.end() #define sz(_v) (int)_v.size() #define pii pair <int, int> #define pll pair <ll, ll> #define veci vector <int> #define vecll vector <ll> veci find_subset(int asd, int asdas, veci w) { ll l = asd, r = asdas; vector <pair <ll, int> > a; for(int i = 0; i < sz(w); ++i) { if(l <= w[i] && w[i] <= r) return {i}; if(w[i] <= r) a.pb(mp(w[i], i)); } sort(all(a)); ll sum = 0; veci res; for(int i = 0; i < sz(a); ++i) { res.pb(a[i].s); sum += a[i].f; if(l <= sum && sum <= r) return res; } reverse(all(a)); res.clear(); sum = 0; for(int i = 0; i < sz(a); ++i) { res.pb(a[i].s); sum += a[i].f; if(l <= sum && sum <= r) return res; } 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...