# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
370461 | amano_hina | Detecting Molecules (IOI16_molecules) | C++14 | 2 ms | 2048 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
using namespace std;
std::vector<int> find_subset(int l, int u, std::vector<int> w) {
pair<int,int> p[200005];
long long n=w.size();
for(int i=0;i<n;i++)
{
p[i].first=w[i];
p[i].second=i;
}
sort(w.begin(),w.end());
vector<int> ans;
long long mn=0,mx=0,cnt;
bool d=1;
for(long long i=0;i<n;i++)
{
mn=mn+w[i];
mx=mx+w[n-1-i];
if(mn>=l&&mn<=u)
{
for(long long j=0;j<=i;j++)
{
ans.push_back(p[j].second);
}
break;
}
else if(mx>=l&&mx<=u)
{
for(long long j=n-1;j>=n-1-i;j--)
{
ans.push_back(p[j].second);
}
break;
}
else if(mn<l&&u<mx)
{
cout<<i<<'\n';
cnt=mn;
for(long long j=i;j>=0;j--)
{
cnt=cnt-w[j]+w[n-1-(i-j)];
if(cnt>=l&&cnt<=u)
{
for(long long k=0;k<j;k++)
{
ans.push_back(p[k].second);
}
for(long long k=n-1;k>=n-1-(i-j);k--)
{
ans.push_back(p[k].second);
}
break;
}
}
break;
}
}
return ans;
}
/*int main()
{
int l,u,x;
cin>>l>>u;
vector<int> w;
vector<int> out;
while(cin>>x)
{
w.push_back(x);
}
out=find_subset(l, u, w);
for(int i=0;i<out.size();i++)
{
cout<<out[i]<<" ";
}
}*/
컴파일 시 표준 에러 (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... |