제출 #529334

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

#define ll long long
#define all(x) x.begin(), x.end()
#define f first
#define s second
#define ca(v) for(auto i:v) cout<<i<<" ";
#define nl cout<<"\n"

const int MOD = 1e9 + 7;

vector<int> find_subset(int l, int r, vector<int> ar){
    sort(all(ar));
    int n = ar.size();
    int sm = 0;
    int p = 0;
    vector<int> emp = {};
    if(ar[0] > l) return emp;
    for(int i=0; i<n; i++){
        if(ar[i] + sm > r) break;
        sm += ar[i];
        p = i;
    }
    for(int i=0; i<=n; i++){
        if(sm >= l && sm <= r){
            vector<int> out = {};
            for(int j=i; j<=p+i; j++){
                out.push_back(j);
            }
            return out;
        }
        if(i + 1 + p >= n) break;
        sm -= ar[i];
        sm += ar[i+p+1];
    }
    return emp;
}

int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0);
    // if (fopen("input.in", "r")) freopen("input.in", "r", stdin);
    vector<int> v = (find_subset(15, 17, {6, 8, 8, 7}));
    ca(v);
}

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

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