답안 #237111

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
237111 2020-06-04T17:14:16 Z uacoder123 Detecting Molecules (IOI16_molecules) C++14
컴파일 오류
0 ms 0 KB
 #include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define FOR(i,a,b) for (auto i = (a); i <= (b); ++i)
#define NFOR(i,a,b) for(auto i = (a); i >= (b); --i)
#define all(x) (x).begin(), (x).end()
#define sz(x) int(x.size())
#define mp(i,a) make_pair(i,a)
#define pb(a) push_back(a)
#define bit(x,b) (x&(1LL<<b))

typedef long long int lli;
typedef pair <lli,lli> ii;
typedef pair <ii,lli> iii;
typedef vector <lli> vi;

int main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  lli test;
  test=1;
  for(;test>0;--test)
  {
    lli n,l,r,l1=0,r1=0;
    cin>>n>>l>>r;
    vector<ii> arr(n);
    for(lli i=0;i<n;++i)
    {
      cin>>arr[i].F;
      arr[i].S=i;
    }
    sort(all(arr));
    vector<ii> p(n+1);
    p[0]=mp(0,0); 
    for(lli i=1;i<=n;++i)
    {
      p[i]=mp(p[i-1].F+arr[i-1].F,i);
    }
    for(lli i=0;i<n;++i)
    {
      auto it = lower_bound(all(p),mp(p[i].F+l,0*1LL));
      if((*it).F-p[i].F>=l&&(*it).F-p[i].F<=r)
      {
        l1=p[i].S;
        r1=(*it).S;
        break;
      }
    }
    cout<<r1-l1<<endl;
    for(lli i=l1+1;i<=r1;++i)
      cout<<arr[i].S<<' ';
    cout<<endl;
  }
  return(0);
}

Compilation message

/tmp/ccqdd1Jd.o: In function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'
/tmp/cc6FzhSm.o:molecules.cpp:(.text.startup+0x0): first defined here
/tmp/ccqdd1Jd.o: In function `main':
grader.cpp:(.text.startup+0x152): undefined reference to `find_subset(int, int, std::vector<int, std::allocator<int> >)'
collect2: error: ld returned 1 exit status