Submission #54066

# Submission time Handle Problem Language Result Execution time Memory
54066 2018-07-02T09:36:47 Z MoNsTeR_CuBe Detecting Molecules (IOI16_molecules) C++17
Compilation error
0 ms 0 KB
#include "molecules.h"
#include <bits/stdc++.h>

using namespace std;

int Segtree[4*109];

int Q(int l, int r, int pos, int ql, int qr){
    if(ql > r || qr < l){
        return 0;
    }
    if(l >= ql && r <= qr){
        return Segtree[pos];
    }
    int mid = (l+r)/2;
    return Q(l,mid, pos*2, ql, qr) + Q(mid+1, r, pos*2+1, ql, qr);
}

void B(vector<int> w, int l, int r, int pos){
    if(l == r){
        Segtree[pos] = w[l-1];
        return;
    }
    int mid = (l+r)/2;
    B(w, l, mid, pos*2);
    B(w, mid+1, r, pos*2+1);
    Segtree[pos] = Segtree[pos*2+1]+Segtree[pos*2];
}

vector<int> find_subset(int n, int l, int u, vector<int> w) {
    B(w, 1, n, 1);
    //for(int i = 1; i < 8; i++) cout << Segtree[i] << ' ';
    //cout << endl;
    for(int i = 0; i < n; i++){
        for(int j = i; j < n; j++){
            int a = Q(1,n, 1, i+1,j+1);
            if(a <= u && a>=l){
                //cout << a << endl;
                vector<int> v(0);
                for(int k = i; k <= j; k++){
                    v.push_back(k);
                }
                return v;
            }
        }
    }
    vector<int> v(0);
    return v;
}

/*int main(){
    int a, b, c;
    cin >> a >> b >> c;
    vector<int> v(0);
    for(int i = 0; i < a; i++){
        int d;
        cin >> d;
        v.push_back(d);
    }
    v = find_subset(a,b,c,v);
    cout << v.size() << endl;
    for(int i = 0; i < v.size(); i++){
        cout << v[i] << ' ';
    }
    cout << endl;
}*/

Compilation message

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