Submission #1171786

#TimeUsernameProblemLanguageResultExecution timeMemory
1171786bbartekA Plus B (IOI23_aplusb)C++20
Compilation error
0 ms0 KiB
#include <bits/stdc++.h>
#include "aplusb.h"

using namespace std;

typedef long long ll;
#define st first
#define nd second
#define pb push_back

vector<int> smallest_sums(ll n, vector<int> A, vector<int> B) {
	ll pocz = A[0] + B[0],kon = A[n-1] + B[n-1],sro;

    ll licznik,punkt;
    while(pocz < kon){
        sro = (pocz+kon)/2;
        licznik = 0,punkt = n-1;
        for(int i=0;i<n;i++){
            if(A[i] + B[0] > sro)
                break;
            while(A[i] + B[punkt] > sro)
                punkt--;

            licznik += punkt+1;
        }
        if(licznik >= n){
            kon = sro;
        }
        else{
            pocz = sro+1;
        }
    }

    vector<int> wyn;

    licznik = 0,punkt = n-1;
    for(int i=0;i<n;i++){
        if(A[i] + B[0] > pocz)
            break;
        for(int j=0;j<n;j++){
            if(A[i]+B[j] > pocz)
                break;

            wyn.pb(A[i] + B[j]);
        }
    }

    sort(wyn.begin(),wyn.end());

    
    while(wyn.size() > n){
        wyn.pop_back();
    }

    return wyn;
}

Compilation message (stderr)

/usr/bin/ld: /tmp/ccy7j6fh.o: in function `main':
grader.cpp:(.text.startup+0x251): undefined reference to `smallest_sums(int, std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >)'
collect2: error: ld returned 1 exit status