제출 #872692

#제출 시각아이디문제언어결과실행 시간메모리
872692LucaLucaMDetecting Molecules (IOI16_molecules)C++17
컴파일 에러
0 ms0 KiB
#include "molecules.h"
#include "grader.cpp"
#include <vector>
#include <cassert>
#include <algorithm>

typedef long long ll;

std::vector<int> find_subset(int l, int u, std::vector<int> w) {
  int n = (int) w.size();
  std::vector<std::pair<int, int>> a(n);
  for (int i = 0; i < n; i++) {
    a[i] = {w[i], i};
  }
  std::sort(a.begin(), a.end());
  std::vector<int> ret;
  ll s = 0;

  for (const auto &[val, idx] : a) {
    if (l <= val && val <= u) {
      ret = {idx};
      return ret;
    }
  }

  for (const auto &[val, idx] : a) {
    if (val < l) {
      s += val;
      ret.push_back(idx);
    }
    if (l <= s && s <= u) {
      return ret;
    }
  }
  return ret;
}

/**

4 15 17
6 8 8 7


**/

컴파일 시 표준 에러 (stderr) 메시지

/usr/bin/ld: /tmp/cc0TLoEd.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/ccFgOCnd.o:molecules.cpp:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status