Submission #1219358

#TimeUsernameProblemLanguageResultExecution timeMemory
1219358LIADetecting Molecules (IOI16_molecules)C++17
31 / 100
1096 ms6032 KiB
#include "molecules.h" #include <bits/stdc++.h> using namespace std; typedef int ll; typedef tuple <ll,ll,ll> plll; typedef vector <plll> vplll; typedef pair <ll,ll> pll; typedef vector <ll> vll; typedef vector <pll> vpll; typedef vector <vector <pll>> vvpll; typedef vector <vector <ll>> vvll; typedef vector <bool> vb; typedef vector <vector <bool>> vvb; #define loop(i, s, e) for (ll i = (s); i < (e); ++i) #define loopr(i, e, s) for (ll i = (e)-1; i >= (s); --i) #define all(a) a.begin(), a.end() const ll inf = 1e9 + 7; std::vector<int> find_subset(int l, int r, std::vector<int> w) { ll n = w.size(); ll maxi =r+2; vector<pair<ll, vll>> dp(maxi,{0,{}} ); dp[0].first = 1; dp[0].second.resize(n,0); // n*maxi loop(i,1,maxi) { loop(j,0,n) { ll num = w[j]; if (i-num>=0 && dp[i-num].first == 1 && dp[i-num].second[j]==0) { dp[i].first = 1; dp[i].second = dp[i-num].second; dp[i].second[j] = 1; } } if (i>=l && i<=r && dp[i].first== 1) { vector<int> ansi; loop(c,0,n) if (dp[i].second[c]== 1) ansi.push_back(c); return ansi; } } return {}; }

Compilation message (stderr)

molecules.h:1:9: warning: #pragma once in main file
    1 | #pragma once
      |         ^~~~
molecules_c.h:1:9: warning: #pragma once in main file
    1 | #pragma once
      |         ^~~~
#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...