제출 #429014

#제출 시각아이디문제언어결과실행 시간메모리
429014TangentDetecting Molecules (IOI16_molecules)C++17
9 / 100
1 ms288 KiB
#include "molecules.h" #include "bits/stdc++.h" using namespace std; typedef long long ll; typedef pair<int, int> pii; typedef pair<ll, ll> pll; typedef vector<int> vii; typedef vector<ll> vll; typedef vector<pii> vpii; typedef vector<pll> vpll; typedef vector<vii> vvii; typedef vector<vll> vvll; typedef vector<vpii> vvpii; typedef vector<vpll> vvpll; #define ffor(i, a, b) for (ll i = (a); i < (ll)(b); i++) #define fford(i, a, b) for (ll i = (a); i > (ll)(b); i--) #define rep(i, n) ffor(i, 0, n) #define forin(x, a) for (auto &x: a) #define all(a) a.begin(), a.end() std::vector<int> find_subset(int l, int u, std::vector<int> w) { map<int, int> cnts; forin(weight, w) { cnts[weight]++; } map<int, pii> reached = {{0, {-1, -1}}}; forin(cnt, cnts) { map<int, pii> nreached(reached); forin(val, reached) { ffor(i, 1, cnt.second + 1) { if (val.first + cnt.first * i > u) { break; } nreached[val.first + cnt.first * i] = {cnt.first, i}; if (val.first + cnt.first * i >= l) { map<int, int> needed; int curr = val.first + cnt.first * i; while(curr) { needed[nreached[curr].first] = nreached[curr].second; curr -= nreached[curr].first * nreached[curr].second; } vii res; rep(j, w.size()) { if (needed[w[j]]) { res.emplace_back(j); needed[w[j]]--; } } return res; } } } reached = move(nreached); } 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...