답안 #1097716

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1097716 2024-10-08T04:20:18 Z Newtonabc Detecting Molecules (IOI16_molecules) C++14
0 / 100
1 ms 348 KB
#include "molecules.h"
#include<bits/stdc++.h>
using namespace std;
const int N=1e5+10;
bool dp[N];
int bk[N];
int n;
vector<int> find_subset(int l, int u, vector<int> w) {
	n=w.size();
	vector<int> ans;
	dp[0]=true;
	for(int i=0;i<n;i++){
		for(int j=u;j>=0;j--){
			if(j-w[i]>=0){
				dp[j]|=dp[j-w[i]];
				bk[j]=i;
			}
		}
	}
	for(int i=l;i<=u;i++){
		if(dp[i]){
			int tmp=i;
			while(1){
				if(tmp==0) break;
				ans.push_back(bk[tmp]);
				tmp=bk[tmp];
			}
			break;
		}
	}
	/*for(int i=0;i<ans.size();i++) cout<<ans[i] <<" ";
	cout<<"\n\n\n";*/
    return ans;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB OK (n = 1, answer = NO)
2 Correct 1 ms 348 KB OK (n = 1, answer = NO)
3 Correct 0 ms 348 KB OK (n = 1, answer = YES)
4 Correct 0 ms 348 KB OK (n = 2, answer = YES)
5 Incorrect 0 ms 348 KB sum of weights should be in [100..100] but it is 200
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 348 KB sum of weights should be in [302..304] but it is 101
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB OK (n = 1, answer = NO)
2 Correct 1 ms 348 KB OK (n = 1, answer = NO)
3 Correct 0 ms 348 KB OK (n = 1, answer = YES)
4 Correct 0 ms 348 KB OK (n = 2, answer = YES)
5 Incorrect 0 ms 348 KB sum of weights should be in [100..100] but it is 200
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB OK (n = 1, answer = NO)
2 Correct 1 ms 348 KB OK (n = 1, answer = NO)
3 Correct 0 ms 348 KB OK (n = 1, answer = YES)
4 Correct 0 ms 348 KB OK (n = 2, answer = YES)
5 Incorrect 0 ms 348 KB sum of weights should be in [100..100] but it is 200
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB OK (n = 1, answer = NO)
2 Correct 1 ms 348 KB OK (n = 1, answer = NO)
3 Correct 0 ms 348 KB OK (n = 1, answer = YES)
4 Correct 0 ms 348 KB OK (n = 2, answer = YES)
5 Incorrect 0 ms 348 KB sum of weights should be in [100..100] but it is 200
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB OK (n = 1, answer = NO)
2 Correct 1 ms 348 KB OK (n = 1, answer = NO)
3 Correct 0 ms 348 KB OK (n = 1, answer = YES)
4 Correct 0 ms 348 KB OK (n = 2, answer = YES)
5 Incorrect 0 ms 348 KB sum of weights should be in [100..100] but it is 200
6 Halted 0 ms 0 KB -