| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 | 
|---|---|---|---|---|---|---|---|
| 101982 | tim25871014 | Detecting Molecules (IOI16_molecules) | C++17 | 0 ms | 0 KiB | 
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "molecules.h"
#include <bits/stdc++.h>
using namespace std;
vector<int> solve(int l,int u,vector<int> w){
    int dp[10010];
    fill(dp,dp+10010,-1);
    dp[0]=0;
    for(int i=0;i<(int)w.size();i++)
        for(int j=u;j>=0;j--){
            if(j-w[i]>=0 && dp[j-w[i]]!=-1)
                if(dp[j]==-1) dp[j]=i;
        }
    vector<int> ans;
    for(int i=l;i<=u;i++)
        if(dp[i]!=-1){
            int now=i;
            while(now!=0){
                ans.push_back(dp[now]);
                now-=w[dp[now]];
            }
            return ans;
        }
    return ans;
}
