이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<bool> vb;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
typedef vector<string> vs;
typedef vector<vb> vvb;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
#define all(x) x.begin(), x.end()
#define rep(i,a,b) for(int i = a; i < b; i++)
vi find_subset(int l, int u, vi wi) {
int N = (int)wi.size();
vpii w(N);
rep(n,0,N) w[n] = make_pair(wi[n], n);
sort(all(w));
long bot = 0;
long top = 0;
int K = 0;
for(int k = 0; k <= N; k++) {
K = k;
if(l <= bot && bot <= u) {
vi ans(0);
rep(i,0,k) ans.push_back(w[i].second);
return ans;
}
if(l <= top && top <= u) {
vi ans(0);
rep(i,0,k) ans.push_back(w[N-1-i].second);
return ans;
}
if(bot < l && u < top)
break;
if(k == N) return vi(0);
bot += w[k].first;
top += w[N-1-k].first;
}
int k2 = 0;
rep(k,0,K) {
k2++;
bot -= w[K-1-k].first;
bot += w[N-1-k].first;
if(bot >= l) break;
}
vi ans(0);
rep(i,0,K-k2) ans.push_back(w[i].second);
rep(i,N-k2,N) ans.push_back(w[i].second);
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |