Submission #252249

#TimeUsernameProblemLanguageResultExecution timeMemory
252249paradoxDetecting Molecules (IOI16_molecules)C++17
46 / 100
190 ms760 KiB
#include "molecules.h" #include <iostream> #include <fstream> #include <vector> #include <set> #include <map> #include <cstring> #include <string> #include <cmath> #include <cassert> #include <ctime> #include <algorithm> #include <sstream> #include <list> #include <queue> #include <deque> #include <stack> #include <cstdlib> #include <cstdio> #include <iterator> #include <functional> #include <unordered_set> #include <unordered_map> using namespace std; #define fi first #define se second #define mp make_pair #define pb push_back #define sz(x) (int)x.size() #define all(x) x.begin(), x.end() #define pii pair<int, int> #define vi vector<int> #define fast_io ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0) typedef long long ll; typedef short inth; const int N = 1e4; const int M = N + 7; const int MOD = 1e9 + 7; const ll INF = 1e16 + 17; bool dp[M]; int par[M]; vector<int> find_subset(int l, int u, vector<int> w) { dp[0] = true; for (int i = 0; i < sz(w); ++i) { for (int j = N; j >= w[i]; --j) { if (!dp[j] && dp[j - w[i]]) { dp[j] = true; par[j] = i; } } } vector<int> ans; int v = 0; for (int i = l; i <= u; ++i) { if (dp[i]) { v = i; break; } } while (v) { ans.pb(par[v]); v -= w[par[v]]; } sort(all(ans)); 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...