제출 #1219450

#제출 시각아이디문제언어결과실행 시간메모리
1219450AMel0nDetecting Molecules (IOI16_molecules)C++20
46 / 100
1093 ms4164 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define FOR(i,N) for(ll i = 0; i < N; i++) #define all(x) (x).begin(), (x).end() #define F first #define S second #include "molecules.h" vector<int> find_subset(int l, int u, vector<int> W) { vector<pair<bool, int>> dp(u+1); dp[0].F = 1; vector<int> res; pair<bool,int> yes = {0,0}; FOR(i, W.size()) { for(int w = u; w > 0; w--) { if (w-W[i] >= 0 && dp[w].F != 1) { if (dp[w-W[i]].F) { dp[w] = {1, i}; } } if (l <= w && w <= u && dp[w].F) { yes = {1, w}; break; } } if (yes.F) break; } if (!yes.F) return res; while(yes.S != 0) { res.push_back(dp[yes.S].S); yes.S = yes.S - W[dp[yes.S].S]; } return res; }

컴파일 시 표준 에러 (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...