Submission #114538

# Submission time Handle Problem Language Result Execution time Memory
114538 2019-06-01T16:47:37 Z ly20 Detecting Molecules (IOI16_molecules) C++17
0 / 100
3 ms 640 KB
#include<bits/stdc++.h>
#define debug(args...) //fprintf(stderr,args)
#include "molecules.h"
using namespace std;
const int MAXN=11234;
int resp[MAXN],kn[MAXN];
vector<int> find_subset(int l,int u,vector<int> w)
{
	int n=w.size();
	for(int i=0;i<MAXN;i++)
	{
		kn[i]=-1;
	}
	kn[0]=-2;
	for(int i=0;i<n;i++)
	{
		for(int j=MAXN-1;j>=w[i];j--)
		{
			if(kn[j-w[i]]!=-1 && kn[j]==-1)kn[j]=i;
		}
	}
	int val=-1;
	for(int i=l;i<=u;i++)
	{
		if(kn[i]!=-1)val=i;
		debug("%d %d\n",i,kn[i]);
	}
	vector<int> result;
	int cont=0;
	while(val>0)
	{
		result[cont]=kn[val];
		val-=w[kn[val]];
		cont++;
	}
	for(int i=0;i<cont;i++)resp[i]=result[i];
	return result;
}
/*int w[MAXN];
int v[MAXN];
int main()
{
	int l,u,n;
	scanf("%d %d %d",&l,&u,&n);
	for(int i=0;i<n;i++)scanf("%d",&w[i]);
	find_subset(l,u,w,n,v);
	for(int i=0;i<n;i++)printf("%d\n",w[resp[i]]);
}*/
# Verdict Execution time Memory Grader output
1 Correct 2 ms 384 KB OK (n = 1, answer = NO)
2 Correct 2 ms 384 KB OK (n = 1, answer = NO)
3 Runtime error 2 ms 640 KB Execution killed with signal 11 (could be triggered by violating memory limits)
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 3 ms 640 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 384 KB OK (n = 1, answer = NO)
2 Correct 2 ms 384 KB OK (n = 1, answer = NO)
3 Runtime error 2 ms 640 KB Execution killed with signal 11 (could be triggered by violating memory limits)
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 384 KB OK (n = 1, answer = NO)
2 Correct 2 ms 384 KB OK (n = 1, answer = NO)
3 Runtime error 2 ms 640 KB Execution killed with signal 11 (could be triggered by violating memory limits)
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 384 KB OK (n = 1, answer = NO)
2 Correct 2 ms 384 KB OK (n = 1, answer = NO)
3 Runtime error 2 ms 640 KB Execution killed with signal 11 (could be triggered by violating memory limits)
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 384 KB OK (n = 1, answer = NO)
2 Correct 2 ms 384 KB OK (n = 1, answer = NO)
3 Runtime error 2 ms 640 KB Execution killed with signal 11 (could be triggered by violating memory limits)
4 Halted 0 ms 0 KB -