제출 #1147631

#제출 시각아이디문제언어결과실행 시간메모리
1147631gulmixDetecting Molecules (IOI16_molecules)C++20
컴파일 에러
0 ms0 KiB
#include "molecules.h"
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
using ll = long long;
#define all(x) x.begin(), x.end()
#define oset tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update>

vector<ll> find_subset(ll l, ll r, vector<ll> w){
    sort(all(w));
    vector<ll> ans;
    ll cur = 0, lx = 0, rx = 0;
    while(lx < w.size() && rx < w.size()){
        if(cur < l){
            cur += w[lx];
            lx++;
            ans.push_back(lx);
        }else if(cur >= l && cur < r){
            return ans;
        }else if(cur >= r){
            cur -= w[rx];
            rx++;
            ans.erase(ans.begin());
        }
    }
    return {};
}

//int main(){
//    ios::sync_with_stdio(false);
//    cin.tie(0);
//    //ifstream cin("cycle2.in");
//    //ofstream cout("cycle2.out");
//    vector<ll> b = {15, 17, 16, 18};
//    vector<ll> a = find_subset(10, 20, b);
//    for(auto &i: a)cout << i << ' ';
//}

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

molecules.h:1:9: warning: #pragma once in main file
    1 | #pragma once
      |         ^~~~
molecules_c.h:1:9: warning: #pragma once in main file
    1 | #pragma once
      |         ^~~~
/usr/bin/ld: /tmp/ccUB0HoF.o: in function `main':
grader.cpp:(.text.startup+0x173): undefined reference to `find_subset(int, int, std::vector<int, std::allocator<int> >)'
collect2: error: ld returned 1 exit status