답안 #1088117

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1088117 2024-09-14T03:06:51 Z LucasLe Detecting Molecules (IOI16_molecules) C++17
컴파일 오류
0 ms 0 KB
#include <molecules.h>
#include <bits/stdc++.h>

#define                int  long long
#define              moony  long long
#define                pii  pair<int, int>
#define                 fi  first
#define                 se  second
#define                 ld  long double
#define                 vi  vector<int>
#define                vii  vector<vector<int>>
#define             all(v)  (v).begin(), (v).end()
#define       rep(i, a, b)  for (int i = (a), _b = (b); i <= _b; ++i)
#define       per(i, b, a)  for (int i = (b), _a = (a); i >= _a; --i)

using namespace std;

const int MOD = 1e9 + 7;

int add(int a, int b) {
  a += b;
  if (a >= MOD) a -= MOD;
  return a;
}

int mul(int a, int b) {
  (a *= b) %= MOD;
  return a;
}

int ceil(int x, int y) {
  return (x + y - 1) / y;
}

int bin_pow(int x, int y) {
  int res=1;
  while(y){if(y&1)res=res*x%MOD;x=x*x%MOD;y>>=1;}
  return res;
}

const int INF = 1e15;
const int maxn = 1e6 + 5;

vector<int> find_subset(int l, int u, vector<int> w) {
  vector<pair<int, int>> v;
  int n = (int)w.size();
  for (int i = 0; i < n; ++i)
    v.push_back({w[i], i});
  v.push_back({INF, n});
  sort(v.begin(), v.end());
  int pref = 0, suff = 0;
  for (int i = 0; i < n; ++i) {
    pref += v[i].first;
    suff += v[n - 1 - i].first;
    if (pref <= u && suff >= l) {
      vector<int> res;
      for (int j = i; j < n; ++j) {
        if (pref >= l) {
          for (int k = j - i; k <= j; ++k)
            res.push_back(v[k].second + 1);
          return res;
        }
        pref += v[j + 1].first - v[j - i].first;
      }
    }
  }
  return vector<int>();
}

Compilation message

/usr/bin/ld: /tmp/ccRuFyqD.o: in function `main':
grader.cpp:(.text.startup+0x18d): undefined reference to `find_subset(int, int, std::vector<int, std::allocator<int> >)'
collect2: error: ld returned 1 exit status