Submission #1067233

# Submission time Handle Problem Language Result Execution time Memory
1067233 2024-08-20T13:17:03 Z ChericMAC A Plus B (IOI23_aplusb) C++17
Compilation error
0 ms 0 KB
#include <aplusb.h>
#include <vector>
#include <algorithm>
using namespace std;

vector<int> smallest_sums(int N, vector<int> A, vector<int> B) {
    vector<int> C;
    for (int i = 0; i < N; i++) {
        for (int j = 0; j < N - i; j++) {
            C.push_back(A[j] + B[i]);
        }
    }
    sort(C.begin(), C.end());
    vector<int> result(N);
    for (int i = 0; i < N; i++) {
        result[i] = C.top();
        C.pop();
    }
    return result;
}

Compilation message

aplusb.cpp: In function 'std::vector<int> smallest_sums(int, std::vector<int>, std::vector<int>)':
aplusb.cpp:16:23: error: 'class std::vector<int>' has no member named 'top'
   16 |         result[i] = C.top();
      |                       ^~~
aplusb.cpp:17:11: error: 'class std::vector<int>' has no member named 'pop'
   17 |         C.pop();
      |           ^~~