# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
156592 | 2019-10-06T14:43:21 Z | a_player | Detecting Molecules (IOI16_molecules) | C++14 | 0 ms | 0 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; int diff[200001]; pair<int,int> v[200001]; vector<int> find_subset(int l,int u,vector<int> w){ int N=w.size(); for(int i=0;i<N;i++){ v[i].f=w[i]; v[i].s=i; } sort(v.begin(),v.end()); for(int i=0;i<N;i++)diff[i]=v[i].f-v[0].f; int h=(u-v[0].f+v[N-1].f)/v[N-1].f; int s=h*v[0].f; vector<int> sol; for(int i=N-1;i>=N-h+1;i--){ s+=diff[i]; sol.push_back(v[i].s); } for(int i=N-h;i>=0;i--)if(s+diff[i]<=u&&s+diff[i]>=l){ sol.push_back(v[i].s); return sol; } vector<int> err; return err; }