이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#define ll long long
#define db long double
#define II pair <ll,ll>
#define III pair <ll,II>
#define IV pair <vector <int>,vector <int> >
#define TII pair <treap*,treap*>
#define fst first
#define snd second
#define BIT(x,i) ((x>>i)&1)
#define pi acos(-1)
#define to_radian(x) (x*pi/180.0)
#define to_degree(x) (x*180.0/pi)
#define Log(x) (31-__builtin_clz((int)x))
#define LogLL(x) (63-__builtin_clzll((ll)x))
using namespace std;
#include "molecules.h"
vector<int> find_subset(int l,int r,vector<int> vec)
{
vector <II> a;
vector <int> res;
for(int x:vec)
{
int tg=a.size();
a.push_back({ x,tg });
}
sort(a.begin(),a.end());
ll sum=0,j=0;
for(int i=0;i<a.size();i++)
{
sum+=a[i].fst;
while(sum>r) sum-=a[j++].fst;
if(sum>=l)
{
for(int k=j;k<=i;k++) res.push_back(a[k].snd);
return res;
}
}
return res;
}
/*
int main()
{
freopen("molecules.inp","r",stdin);
freopen("molecules.out","w",stdout);
int l,r,x;
vector <int> vec;
cin>>l>>r;
while(cin>>x) vec.push_back(x);
vector <int> res=find_subset(l,r,vec);
for(int x:res) cout<<x<<" ";
}
*/
컴파일 시 표준 에러 (stderr) 메시지
molecules.cpp: In function 'std::vector<int> find_subset(int, int, std::vector<int>)':
molecules.cpp:30:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<long long int, long long int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
30 | for(int i=0;i<a.size();i++)
| ~^~~~~~~~~
# | 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... |