Submission #1171873

#TimeUsernameProblemLanguageResultExecution timeMemory
1171873h1440Detecting Molecules (IOI16_molecules)C++17
46 / 100
1095 ms2376 KiB
#include "molecules.h"
#include <bits/stdc++.h>
#define _ ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define fore(i,a,b) for(lli i = (a), abcdxd = (b); i < abcdxd; i++)
#define f first
#define s second
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define ENDL '\n'
#define sz(s) lli((s).size())
#define pb push_back
using namespace std;
typedef int lli;
// typedef long long LLI;
typedef pair<lli, lli> ii;
typedef vector<lli> vi;
typedef vector<ii> vii;
typedef long double ld;
#define deb(x) cout << #x << ": " << x << endl;
#define BIGLLI __int128

std::vector<int> find_subset(int l, int u, std::vector<int> w) {
    lli n = sz(w);
    vi dp(u + 5, -1); dp[0] = 0;
    fore(j,0,n) for (lli i = u; i >= w[j]; i--) dp[i] = (dp[i - w[j]] > -1 and dp[i] == -1 ? j : dp[i]);
    vi ans;
    lli id = 0; fore(i,l,u+1) id = (dp[i] > -1 ? i : id);
    while (id){
        ans.pb(dp[id]);
        id -= w[dp[id]];
    }
    return ans;
}

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...