Submission #206343

#TimeUsernameProblemLanguageResultExecution timeMemory
206343autumn_eelDetecting Molecules (IOI16_molecules)C++14
19 / 100
8 ms888 KiB
#include <bits/stdc++.h> #define rep(i,n)for(int i=0;i<(n);i++) #include "molecules.h" using namespace std; bitset<500001>bit; std::vector<int> find_subset(int l, int u, std::vector<int> w) { bit[0]=1; rep(i,w.size()){ bit|=bit<<w[i]; } for(int i=l;i<=u;i++){ if(bit[i]==1){ int x=w.size(),y=i; vector<int>ans; while(x){ x--; if(y>=w[x]&&bit[y-w[x]]){ ans.push_back(x); y-=w[x]; } } assert(y==0); reverse(ans.begin(),ans.end()); return ans; } } return {}; }

Compilation message (stderr)

molecules.cpp: In function 'std::vector<int> find_subset(int, int, std::vector<int>)':
molecules.cpp:2:30: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
 #define rep(i,n)for(int i=0;i<(n);i++)
                              ^
molecules.cpp:9:2: note: in expansion of macro 'rep'
  rep(i,w.size()){
  ^~~
#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...