# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1137249 | rayan_bd | Detecting Molecules (IOI16_molecules) | C++20 | 0 ms | 328 KiB |
#include <bits/stdc++.h>
using namespace std;
#define getar(ar,n) for(ll i=0;i<n;++i) cin>>ar[i]
#define show(n) cout<<n<<'\n'
#define all(v) v.begin(), v.end()
#define br cout<<"\n"
#define pb push_back
#define nl '\n'
#define yes cout<<"YES\n"
#define no cout<<"NO\n"
#define ret return
#define ll long long
#define ld long double
#define sza(x) ((int)x.size())
#define fi first
#define se second
const int mxN = 1e5 + 5;
const ll MOD = 1e9 + 7;
const ll INF = 1e9;
const ld EPS = 1e-9;
vector<int> find_subset(int L,int R,vector<int> w){
int n=w.size();
vector<pair<int,int>> vec;
for(int i=0;i<n;++i){
vec.push_back({w[i],i});
}
sort(all(vec));
vector<int> ans;
int i=0,j=0,sum=0;
while(j<n){
sum+=vec[j].fi;
while(sum>R&&i<j){
sum-=vec[i++].fi;
}
if(i<=j&&sum>=L&&sum<=R){
ll tot=0;
while(i<=j){
tot+=vec[i].fi;
ans.pb(vec[i++].se+1);
}
if(tot>=L&&tot<=R) return ans;
else ans.clear();
}
++j;
}
return ans;
}
컴파일 시 표준 에러 (stderr) 메시지
# | 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... |