제출 #775533

#제출 시각아이디문제언어결과실행 시간메모리
775533agussDetecting Molecules (IOI16_molecules)C++17
컴파일 에러
0 ms0 KiB
#include "molecules.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

vector<int> find_subset(int l, int u, vector<int> w) {
    int n = w.size();
    vector<pair<int, int>> v(n);
    vector<int> ans;
    for(int i = 0; i < n; i++){
        v[i].first = w[i];
        v[i].second = i;
    }
    sort(v.begin(), v.end());
    ll sum = v[0].first, s = 0, e = 0;
    while(e < n and s < n){
        if(sum >= l and sum <= u){
            for(int i = s; i <= e; i++)
                ans.push_back(v[i].second);
            return ans;
        }
        if(sum < l)
            sum += v[++e].first;
        if(sum > u) 
            sum -= v[s++].first;
        
    }
    return vector<int>(0);
}
int main(){
    int l, u, n;
    cin >> l >> u >> n;
    vector<int> arr(n);
    for(int &i : arr) cin >> i;
    vector<int> ans = find_subset(l, u, arr);
    for(int i : ans) cout << i << " ";
    return 0;
}

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

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