답안 #1102185

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1102185 2024-10-17T15:47:48 Z akzytr Detecting Molecules (IOI16_molecules) C++17
0 / 100
1 ms 336 KB
// #include "molecules.h"
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;

vector<int> find_subset(int l, int u, vector<int> w) {
	vector<int> result;

	int n = w.size();
	bitset<30002> dp[n + 1];

	dp[0][0] = 1;

	for(int i = 0; i < n; i++) {
		dp[i + 1] |= (dp[i] << w[i]);
	}

	for(int i = l; i <= u; i++) {
		if(dp[n][i]) {
			int cur_s = i;
			for(int j = n - 1; j >= 0; j--) {
				if(cur_s - w[j] >= 0 && dp[j][cur_s - w[j]]) {
					cur_s -= w[j];
					result.push_back(j);
				}
				if(cur_s == 0) {
					break;
				}
			}
			break;
		}
	}

	return result;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 336 KB OK (n = 1, answer = NO)
2 Correct 1 ms 336 KB OK (n = 1, answer = NO)
3 Correct 1 ms 336 KB OK (n = 1, answer = YES)
4 Correct 1 ms 336 KB OK (n = 2, answer = YES)
5 Incorrect 1 ms 336 KB Contestant can not find answer, jury can
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 336 KB Contestant can not find answer, jury can
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 336 KB OK (n = 1, answer = NO)
2 Correct 1 ms 336 KB OK (n = 1, answer = NO)
3 Correct 1 ms 336 KB OK (n = 1, answer = YES)
4 Correct 1 ms 336 KB OK (n = 2, answer = YES)
5 Incorrect 1 ms 336 KB Contestant can not find answer, jury can
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 336 KB OK (n = 1, answer = NO)
2 Correct 1 ms 336 KB OK (n = 1, answer = NO)
3 Correct 1 ms 336 KB OK (n = 1, answer = YES)
4 Correct 1 ms 336 KB OK (n = 2, answer = YES)
5 Incorrect 1 ms 336 KB Contestant can not find answer, jury can
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 336 KB OK (n = 1, answer = NO)
2 Correct 1 ms 336 KB OK (n = 1, answer = NO)
3 Correct 1 ms 336 KB OK (n = 1, answer = YES)
4 Correct 1 ms 336 KB OK (n = 2, answer = YES)
5 Incorrect 1 ms 336 KB Contestant can not find answer, jury can
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 336 KB OK (n = 1, answer = NO)
2 Correct 1 ms 336 KB OK (n = 1, answer = NO)
3 Correct 1 ms 336 KB OK (n = 1, answer = YES)
4 Correct 1 ms 336 KB OK (n = 2, answer = YES)
5 Incorrect 1 ms 336 KB Contestant can not find answer, jury can
6 Halted 0 ms 0 KB -