Submission #156459

#TimeUsernameProblemLanguageResultExecution timeMemory
156459a_playerDetecting Molecules (IOI16_molecules)C++14
0 / 100
2 ms376 KiB
#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 (stderr)

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 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...