Submission #156459

# Submission time Handle Problem Language Result Execution time Memory
156459 2019-10-05T20:43:18 Z a_player Detecting Molecules (IOI16_molecules) C++14
0 / 100
2 ms 376 KB
#include <bits/stdc++.h>

#define f first
#define s second
#define mp make_pair
#define pb push_back

using namespace std;

typedef long long ll;

pair<int,int> dp[1001];

vector<int> find_subset(int l,int u,vector<int> w){
	int N=w.size();
	dp[0].f=1;
	dp[0].s=-1;
	for(int i=0;i<N;i++)
	for(int j=l;j>=0;j--)
		if(j-w[i]>=0)if(dp[j-w[i]].f)dp[j]=mp(1,i);
		int t=-1;
		for(int i=u;i<=l;i++)if(dp[i].f){
			t=i;
			break;
			}vector<int> sol;
  			if(t==-1)return sol;
			while(dp[t].s!=-1){
				sol.push_back(dp[t].s);
				t-=w[dp[t].s];
				}
		
	return sol;
}

Compilation message

molecules.cpp: In function 'std::vector<int> find_subset(int, int, std::vector<int>)':
molecules.cpp:19:2: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
  for(int j=l;j>=0;j--)
  ^~~
molecules.cpp:21:3: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
   int t=-1;
   ^~~
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB OK (n = 1, answer = NO)
2 Correct 2 ms 256 KB OK (n = 1, answer = NO)
3 Correct 2 ms 256 KB OK (n = 1, answer = YES)
4 Incorrect 2 ms 252 KB item #1 is taken twice
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 376 KB Contestant can not find answer, jury can
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB OK (n = 1, answer = NO)
2 Correct 2 ms 256 KB OK (n = 1, answer = NO)
3 Correct 2 ms 256 KB OK (n = 1, answer = YES)
4 Incorrect 2 ms 252 KB item #1 is taken twice
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB OK (n = 1, answer = NO)
2 Correct 2 ms 256 KB OK (n = 1, answer = NO)
3 Correct 2 ms 256 KB OK (n = 1, answer = YES)
4 Incorrect 2 ms 252 KB item #1 is taken twice
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB OK (n = 1, answer = NO)
2 Correct 2 ms 256 KB OK (n = 1, answer = NO)
3 Correct 2 ms 256 KB OK (n = 1, answer = YES)
4 Incorrect 2 ms 252 KB item #1 is taken twice
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB OK (n = 1, answer = NO)
2 Correct 2 ms 256 KB OK (n = 1, answer = NO)
3 Correct 2 ms 256 KB OK (n = 1, answer = YES)
4 Incorrect 2 ms 252 KB item #1 is taken twice
5 Halted 0 ms 0 KB -