제출 #995716

#제출 시각아이디문제언어결과실행 시간메모리
995716kokoueDetecting Molecules (IOI16_molecules)C++14
31 / 100
1100 ms49396 KiB
#include<bits/stdc++.h> #define maxn 1000000 using namespace std; //set<long long> is; unordered_map<int,bool> is; unordered_map<long long,long long> idx; vector<int> find_subset(int l,int u,vector<int> w) { int n=w.size(); is[0]=1; idx[0]=0; int sum=0; bool fl=0; long long mx=0; for(int i=0;i<n;i++) { for(int j=mx;j>=0;j--) { if(!is[j]) continue; long long e=j; if(!is[e+w[i]]) { is[e+w[i]]=1; idx[e+w[i]]=i; if(e+w[i]>=l && e+w[i]<=u) { sum=e+w[i]; fl=1; break; } mx=max(mx,e+w[i]); } } if(fl) break; } vector<int> res; while(sum!=0) { res.push_back(idx[sum]); sum-=w[idx[sum]]; } return res; }
#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...